plan9port/src/lib9/ffork-pthread.c

28 lines
404 B
C
Raw Normal View History

#define NOPLAN9DEFINES
#include <u.h>
#include <libc.h>
2003-11-23 18:12:54 +00:00
#include <pthread.h>
extern int __isthreaded;
int
ffork(int flags, void(*fn)(void*), void *arg)
{
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();
}