diff options
| author | rsc <devnull@localhost> | 2004-12-25 21:56:33 +0000 |
|---|---|---|
| committer | rsc <devnull@localhost> | 2004-12-25 21:56:33 +0000 |
| commit | 1544f90960275dc9211bde30329c3258e0e1bf38 (patch) | |
| tree | f55e7a73c03aaa24daa7cc2ad02822b921c477f9 /src/libthread/proctab.c | |
| parent | 7788fd54094693384ef5c92c475656dba8819feb (diff) | |
| download | plan9port-1544f90960275dc9211bde30329c3258e0e1bf38.tar.gz plan9port-1544f90960275dc9211bde30329c3258e0e1bf38.zip | |
New thread library
Diffstat (limited to 'src/libthread/proctab.c')
| -rw-r--r-- | src/libthread/proctab.c | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/src/libthread/proctab.c b/src/libthread/proctab.c deleted file mode 100644 index b8dd2097..00000000 --- a/src/libthread/proctab.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "threadimpl.h" - -/* this will need work */ -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]; - -void -_threadsetproc(Proc *p) -{ - int h; - - if(!multi){ - theproc = p; - return; - } - lock(&ptablock); - h = ((unsigned)p->pid)%PTABHASH; - p->link = ptab[h]; - unlock(&ptablock); - ptab[h] = p; -} - -static Proc* -__threadgetproc(int rm) -{ - Proc **l, *p; - int h, pid; - - if(!multi) - return theproc; - - pid = getpid(); - - lock(&ptablock); - h = ((unsigned)pid)%PTABHASH; - for(l=&ptab[h]; p=*l; l=&p->link){ - if(p->pid == pid){ - if(rm) - *l = p->link; - unlock(&ptablock); - return p; - } - } - unlock(&ptablock); - return nil; -} - -Proc* -_threadgetproc(void) -{ - return __threadgetproc(0); -} - -Proc* -_threaddelproc(void) -{ - return __threadgetproc(1); -} |
