home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!spool.mu.edu!agate!rsoft!mindlink!a269
- From: Mischa_Sandberg@mindlink.bc.ca (Mischa Sandberg)
- Newsgroups: comp.os.msdos.programmer
- Subject: Re: Threads/Coroutines for DOS
- Message-ID: <15078@mindlink.bc.ca>
- Date: 12 Sep 92 22:39:15 GMT
- Organization: MIND LINK! - British Columbia, Canada
- Lines: 19
-
- You can implement this "by hand" quite tidily, using setjmp, longjmp
- and a bit of jiggery-pokery. You need a small function that uses
- "setjmp" to calculate the amount of stack used, then save that portion
- of stack as the "thread". Then, a small table that identifies each
- stack, and "invoke" and "respond" routines that let you pass
- arguments and results through. All this takes is a little experimentation
- as to the contents of the JMP_BUF struct as your compiler sees it.
-
- Then comes the hard part: getting each thread to stay out of each other
- threads globals :-).
-
-
- --
- Mischa Sandberg ... Mischa_Sandberg@mindlink.bc.ca
- or uunet!van-bc!rsoft!mindlink!Mischa_Sandberg
- *-*-*-*-*-*-*-*-*-*-*
- Engineers think equations are an approximation of reality.
- Physicists think reality is an approximation of the equations.
- Mathematicians never make the connection.
-