🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #1468

Re: Threads/Coroutines for DOS

#1468
From: Mischa Sandberg
Date: Sat, 12 Sep 1992 22:39
19 lines
1240 bytes
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.
Technical Details
Message-ID: <15078@mindlink.bc.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!spool.mu.edu!agate!rsoft!mindlink!a269

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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