From 5a8e63b2f016735364d17866d5e2bcb35d20c78b Mon Sep 17 00:00:00 2001 From: rsc Date: Sun, 29 Feb 2004 22:10:26 +0000 Subject: Fighting the good fight. Move libfmt, libutf into subdirectories of lib9. Add poll-based socket i/o to libthread, so that we can avoid using multiple procs when possible, thus removing dependence on crappy pthreads implementations. Convert samterm, acme to the single-proc libthread. Bring libcomplete, acme up-to-date w.r.t. Plan 9 distribution. --- src/libthread/create.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/libthread/create.c') diff --git a/src/libthread/create.c b/src/libthread/create.c index d487e195..518eaae6 100644 --- a/src/libthread/create.c +++ b/src/libthread/create.c @@ -86,6 +86,7 @@ proccreate(void (*f)(void*), void *arg, uint stacksize) p = _threadgetproc(); if(p->idle){ + fprint(2, "cannot create procs once there is an idle thread\n"); werrstr("cannot create procs once there is an idle thread"); return -1; } @@ -124,6 +125,7 @@ threadcreateidle(void (*f)(void *arg), void *arg, uint stacksize) int id; if(_threadprocs!=1){ + fprint(2, "cannot have idle thread in multi-proc program\n"); werrstr("cannot have idle thread in multi-proc program"); return -1; } @@ -153,6 +155,8 @@ _newproc(void (*f)(void *arg), void *arg, uint stacksize, char *name, int grp, i else *_threadpq.tail = p; _threadpq.tail = &p->next; + if(_threadprocs == 1) + _threadmultiproc(); _threadprocs++; unlock(&_threadpq.lock); return p; -- cgit v1.2.3