From: Eli Zaretskii Newsgroups: comp.os.msdos.djgpp Subject: Re: multithreading dpmi host Date: Sat, 26 Feb 2000 10:05:21 +0200 Organization: NetVision Israel Lines: 16 Message-ID: <38B78941.F04D3F22@is.elta.co.il> References: <951495714 DOT 21465 DOT 0 DOT pluto DOT d4ee0fa5 AT news DOT demon DOT nl> NNTP-Posting-Host: ras1-p67.rvt.netvision.net.il Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.netvision.net.il 951552378 15378 62.0.172.69 (26 Feb 2000 08:06:18 GMT) X-Complaints-To: abuse AT netvision DOT net DOT il NNTP-Posting-Date: 26 Feb 2000 08:06:18 GMT X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en,ru,hebrew To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com OiSyN wrote: > > Does anyone know a dpmi server that allowes multithreading. > It's just that when I hook the timer interrupt to change between > threads, my stackpointer is scrambled because the dpmi host > has a routine of its own that runs before my interrupt routine. The DPMI spec explicitly forbids switching stacks from within a hardware interrupt handler, so it's no surprise this happened to you. The only ``right'' way of doing multithreading under DPMI is to switch threads from a handler for signal SIGALRM, and use the setitimer library function to schedule SIGALRM at the frequency you want it to happen. This has its disadvantages (signals in DJGPP are deferred when the CPU is in real mode, so thread switches might be delayed in some cases), but it's pretty much the only way of getting it to work in the DPMI environment.