delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/11/12/07:59:57

From: fjh AT cs DOT mu DOT OZ DOT AU (Fergus Henderson)
Subject: Re: How about a _beginthread implementation of fork?
12 Nov 1997 07:59:57 -0800 :
Message-ID: <199711121540.CAA32751.cygnus.gnu-win32@mundook.cs.mu.OZ.AU>
References: <199711120808 DOT IAA08724 AT out4 DOT ibm DOT net>
To: gnu-win32 AT cygnus DOT com

vischne AT ibm DOT 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 AT cs DOT mu DOT oz DOT 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 AT 128 DOT 250 DOT 37 DOT 3         |     -- the last words of T. S. Garp.
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019