From fd04aacee17b348da206c13a550dc1029669805f Mon Sep 17 00:00:00 2001 From: rsc Date: Sun, 23 Nov 2003 18:12:54 +0000 Subject: Various additions and fixes. --- src/lib9/ffork-pthread.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/lib9/ffork-pthread.c (limited to 'src/lib9/ffork-pthread.c') diff --git a/src/lib9/ffork-pthread.c b/src/lib9/ffork-pthread.c new file mode 100644 index 00000000..189ac94f --- /dev/null +++ b/src/lib9/ffork-pthread.c @@ -0,0 +1,26 @@ +#include +#include + +extern int __isthreaded; +int +ffork(int flags, void(*fn)(void*), void *arg) +{ + void *p; + pthread_t tid; + + if(flags != (RFMEM|RFNOWAIT)){ + werrstr("ffork unsupported"); + return -1; + } + + if(pthread_create(&tid, NULL, (void*(*)(void*))fn, arg) < 0) + return -1; + return (int)tid; +} + +int +getfforkid(void) +{ + return (int)pthread_self(); +} + -- cgit v1.2.3