This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How about a _beginthread implementation of fork?


vischne@ibm.net writes:

>This is probably a naive approach, but is the following code an accurate
>representation of how to implement fork() using the Windows 95 RTL C
>library?

I don't think so.  fork() gives you two copies of the C stack,
and copies of global variables (including those used by the
standard library, e.g. environ, stdout, etc.), and two copies
of OS-related data structures (pids, signal handler tables, etc.).
Offhand I don't know exactly what _beginthread() does,
and I don't have the appropriate documentation on hand,
but generally threads share the same global variables,
and the child thread gets an empty stack, not a copy of
the parent's stack.

--
Fergus Henderson <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]