From 16984701aa5165b77f229cc318e8025ee8cf81b5 Mon Sep 17 00:00:00 2001 From: Mystery Man Date: Mon, 14 May 2001 14:17:54 +0000 Subject: This commit was manufactured by cvs2svn to create branch 'dietlibc'. --- mdk-stage1/dietlibc/libpthread/pthread_atfork.c | 77 +++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 mdk-stage1/dietlibc/libpthread/pthread_atfork.c (limited to 'mdk-stage1/dietlibc/libpthread/pthread_atfork.c') diff --git a/mdk-stage1/dietlibc/libpthread/pthread_atfork.c b/mdk-stage1/dietlibc/libpthread/pthread_atfork.c new file mode 100644 index 000000000..2dc612dcc --- /dev/null +++ b/mdk-stage1/dietlibc/libpthread/pthread_atfork.c @@ -0,0 +1,77 @@ +#include +#include + +#include +#include "thread_internal.h" + +#define PTHREAD_NUM_ATFORK 4 + +static struct _pthread_fastlock __atfork_struct_lock; +static struct { + int used; + void (*prepare)(void); + void (*parent)(void); + void (*child)(void); +} pthread_atfork_buf[PTHREAD_NUM_ATFORK]; + +int pthread_atfork(void (*prepare)(void), + void (*parent)(void), + void (*child)(void)) +{ + int i,ret=-1; + + __NO_ASYNC_CANCEL_BEGIN; + __pthread_lock(&__atfork_struct_lock); + + for (i=0;i0) { /* parent */ + for (i=0;i