Subject: Outsourcing fork() to RTLDLL
From: [email-masked]

19 Nov 1997 07:55:54 -0800
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
To: [email-masked]

Actually, the trick to simulating fork() under Windows is to program a
multi-threaded version of <setjmp.h> in which `longjmp(env, rval)' keeps
the stack of the thread calling it, copying any things necessary to
simulate the longjmp calling environment onto that stack.

This is because the Windows version of a thread involves a function, not a
region of code in a parent process.  So, the `thread' function can't
return to the parent process.  The best it can do is to longjmp back to
the code implementing fork().

Then, of course, a Windows process is an entire program and is created by
CreateProcess, which means that Linux getpid() has to be implemented as a
call to GetCurrentThreadID().

Come to think of it, wasn't it OS/2 that originally got us into this mess?
Windows 95/NT is just a belated OS/2 implementation.

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".