Add support for user-level 9P servers/clients and various bug fixes to go with them.

This commit is contained in:
rsc 2003-12-11 17:48:38 +00:00
parent ac244f8d28
commit 32f69c36e0
60 changed files with 965 additions and 485 deletions

View file

@ -1,8 +1,7 @@
#include "threadimpl.h"
Pqueue _threadpq;
int _threadmultiproc;
int _threadprocs;
static int nextID(void);
@ -90,7 +89,6 @@ proccreate(void (*f)(void*), void *arg, uint stacksize)
werrstr("cannot create procs once there is an idle thread");
return -1;
}
_threadmultiproc = 1;
return procrfork(f, arg, stacksize, 0);
}
@ -125,11 +123,12 @@ threadcreateidle(void (*f)(void *arg), void *arg, uint stacksize)
{
int id;
if(_threadmultiproc){
if(_threadprocs!=1){
werrstr("cannot have idle thread in multi-proc program");
return -1;
}
id = newthread(_threadgetproc(), f, arg, stacksize, nil, threadgetgrp());
_threaddebug(DBGSCHED, "idle is %d", id);
_threadidle();
return id;
}
@ -154,6 +153,7 @@ _newproc(void (*f)(void *arg), void *arg, uint stacksize, char *name, int grp, i
else
*_threadpq.tail = p;
_threadpq.tail = &p->next;
_threadprocs++;
unlock(&_threadpq.lock);
return p;
}