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.
This commit is contained in:
parent
d51419bf43
commit
5a8e63b2f0
107 changed files with 665 additions and 6637 deletions
|
|
@ -6,6 +6,18 @@ enum
|
|||
PTABHASH = 257,
|
||||
};
|
||||
|
||||
static int multi;
|
||||
static Proc *theproc;
|
||||
|
||||
void
|
||||
_threadmultiproc(void)
|
||||
{
|
||||
if(multi == 0){
|
||||
multi = 1;
|
||||
_threadsetproc(theproc);
|
||||
}
|
||||
}
|
||||
|
||||
static Lock ptablock;
|
||||
Proc *ptab[PTABHASH];
|
||||
|
||||
|
|
@ -14,6 +26,10 @@ _threadsetproc(Proc *p)
|
|||
{
|
||||
int h;
|
||||
|
||||
if(!multi){
|
||||
theproc = p;
|
||||
return;
|
||||
}
|
||||
lock(&ptablock);
|
||||
h = ((unsigned)p->pid)%PTABHASH;
|
||||
p->link = ptab[h];
|
||||
|
|
@ -27,6 +43,9 @@ __threadgetproc(int rm)
|
|||
Proc **l, *p;
|
||||
int h, pid;
|
||||
|
||||
if(!multi)
|
||||
return theproc;
|
||||
|
||||
pid = _threadgetpid();
|
||||
|
||||
lock(&ptablock);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue