* fork.cc (fork_child): Call the __pthread_atforkchild function.

(fork_parent): Call the __pthread_atforkparent function.
* cygwin.din: Export pthread_atfork.
* thread.h (callback): New class.
(MTinterface): Use it.
* thread.cc (__pthread_atforkprepare): New function.
(__pthread_atforkparent): New function.
(__pthread_atforkchild): New function.
(__pthread_atfork): New function.
* pthread.cc (pthread_atfork): New function.
This commit is contained in:
Christopher Faylor
2001-04-13 15:28:20 +00:00
parent e61cead397
commit 39b6859a28
7 changed files with 163 additions and 4 deletions

View File

@ -307,6 +307,7 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls)
/* Initialize signal/process handling */
sigproc_init ();
__pthread_atforkchild();
cygbench ("fork-child");
return 0;
}
@ -597,6 +598,7 @@ out:
ForceCloseHandle (forker_finished);
forker_finished = NULL;
pi.hThread = NULL;
__pthread_atforkparent();
return forked->pid;
@ -640,6 +642,9 @@ fork ()
return -1;
}
/* call the pthread_atfork prepare functions */
__pthread_atforkprepare();
void *esp;
__asm ("movl %%esp,%0": "=r" (esp));