home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / os / msdos / programm / 9310 < prev    next >
Encoding:
Internet Message Format  |  1992-09-12  |  1.2 KB

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