aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/fork.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-10-22 20:16:31 +0000
committerChristopher Faylor <me@cgf.cx>2002-10-22 20:16:31 +0000
commitd525130f0403aff59eca72693d9a15648741e88e (patch)
tree16549d8075aa4ee8df6f5f6c64717b4218072640 /winsup/cygwin/fork.cc
parent329b9ead3ea5a48d452ce48538a4584835c70555 (diff)
downloadnewlib-d525130f0403aff59eca72693d9a15648741e88e.zip
newlib-d525130f0403aff59eca72693d9a15648741e88e.tar.gz
newlib-d525130f0403aff59eca72693d9a15648741e88e.tar.bz2
* cygthread.cc (cygthread::exiting): New variable.
(cygthread::initialized): Delete. (cygthread::stub): Use exiting variable to determine when to exit. (cygthread::runner): Delete. (cygthread_protect): New variable. (cygthread::init): Don't start runner thread. Initialize muto for list protection. (cygthread::freerange): Return pointer to cygthread. (cygthread::operator new): Change logic to start threads on an as-needed basis. (cygthread::detach): Don't zero id. (cygthread::terminate): Don't kill any executing threads. Just set exiting flag. * cygthread.h (cygthread): Reflect above changes. * dcrt0.cc (dll_crt0_1): Move cygthread initialization later. * fork.cc (fork_child): Do fdtab fixup after dll fixup or (apparently) winsock may allocate memory in dll load address.
Diffstat (limited to 'winsup/cygwin/fork.cc')
-rw-r--r--winsup/cygwin/fork.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc
index 165c794..a547c77 100644
--- a/winsup/cygwin/fork.cc
+++ b/winsup/cygwin/fork.cc
@@ -281,8 +281,6 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls)
if (fixup_mmaps_after_fork (hParent))
api_fatal ("recreate_mmaps_after_fork_failed");
- cygheap->fdtab.fixup_after_fork (hParent);
- ProtectHandleINH (hParent);
MALLOC_CHECK;
@@ -291,10 +289,16 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls)
that we're done, and wait for the parent to fill in the.
loaded dlls' data/bss. */
if (!load_dlls)
- sync_with_parent ("performed fork fixup.", FALSE);
+ {
+ cygheap->fdtab.fixup_after_fork (hParent);
+ ProtectHandleINH (hParent);
+ sync_with_parent ("performed fork fixup.", FALSE);
+ }
else
{
dlls.load_after_fork (hParent, first_dll);
+ cygheap->fdtab.fixup_after_fork (hParent);
+ ProtectHandleINH (hParent);
sync_with_parent ("loaded dlls", TRUE);
}