diff options
author | Robert Collins <rbtcollins@hotmail.com> | 2002-09-17 13:12:36 +0400 |
---|---|---|
committer | Robert Collins <rbtcollins@hotmail.com> | 2002-09-17 13:12:36 +0400 |
commit | f1f1379560fafd4608b35c2ea6264cee5fdc1adf (patch) | |
tree | f2d9a672f071f0251f32c45d2aa78ee14bddb6a1 /winsup/cygwin/fork.cc | |
parent | cbb704cf60ce9b25918b4481e72aef1b0fc12356 (diff) |
2002-09-17 Robert Collins <rbtcollins@hotmail.com>
This work inspires by Thomas Pfaff's pthread_fork patch (1).
* fork.cc (fork_child): Remove MTinterface fixup call, it's
adsorbed by pthread::atforkchild.
Rename __pthread_atforkchild to pthread::atforkchild to give
access to private members.
(fork_parent): Rename __pthread_atforkparent to
pthread::atforkparent to give it access to private members.
Ditto for __pthread_atforkprepare.
* thread.cc: Fix some formatting problems throughout.
(MTinterface::fixup_before_fork): Implement.
(MTinterface::fixup_after_fork): Fix pthread_keys.
(pthread_key::keys): Implement.
(pthread_key::fixup_before_fork): Ditto.
(pthread_key::fixup_after_fork): Ditto.
(pthread_key::pthread_key): Add to pthread_key::keys.
(pthread_key::~pthread_key): Remove from pthread_key::keys.
(pthread_key::saveKeyToBuffer): Implement.
(pthread_key::recreateKeyFromBuffer): Ditto.
(pthread::atforkprepare): Prepare all MT classes for fork.
(pthread::atforkchild): And fix them up afterwards.
* thread.h (pthread_key): Buffer the key value during
fork in fork_buf.
List the keys needing to be fixed up in a linked list with
head pthread_key::keys.
(pthread): Move atfork cygwin internal calls into the class.
(MTInterface): Provide a fixup_before_fork for objecst that
need to save state.
(__pthread_atforkprepare): Remove.
(__pthread_atforkparent): Remove.
(__pthread_atforkchild): Remove.
Diffstat (limited to 'winsup/cygwin/fork.cc')
-rw-r--r-- | winsup/cygwin/fork.cc | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index e566bf0e6..dab9aced0 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -313,10 +313,8 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls) if ((*t)->clear_on_fork ()) (*t)->set (); - user_data->threadinterface->fixup_after_fork (); - wait_for_sigthread (); - __pthread_atforkchild (); + pthread::atforkchild (); cygbench ("fork-child"); return 0; } @@ -354,8 +352,7 @@ fork_parent (HANDLE& hParent, dll *&first_dll, DWORD rc; PROCESS_INFORMATION pi = {0, NULL, 0, 0}; - /* call the pthread_atfork prepare functions */ - __pthread_atforkprepare (); + pthread::atforkprepare (); subproc_init (); @@ -601,7 +598,7 @@ fork_parent (HANDLE& hParent, dll *&first_dll, ForceCloseHandle (forker_finished); forker_finished = NULL; pi.hThread = NULL; - __pthread_atforkparent (); + pthread::atforkparent (); return forked->pid; |