From 1544f90960275dc9211bde30329c3258e0e1bf38 Mon Sep 17 00:00:00 2001 From: rsc Date: Sat, 25 Dec 2004 21:56:33 +0000 Subject: New thread library --- src/libthread/proctab.ch | 97 ------------------------------------------------ 1 file changed, 97 deletions(-) delete mode 100644 src/libthread/proctab.ch (limited to 'src/libthread/proctab.ch') diff --git a/src/libthread/proctab.ch b/src/libthread/proctab.ch deleted file mode 100644 index d51543f9..00000000 --- a/src/libthread/proctab.ch +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Proc structure hash table indexed by proctabid() (usually getpid()). - * No lock is necessary for lookups (important when called from signal - * handlers). - * - * To be included from other files (e.g., Linux-clone.c). - */ - -#define T ((void*)-1) - -enum -{ - PTABHASH = 1031, -}; - -static Lock ptablock; -static Proc *proctab[PTABHASH]; -static Proc *theproc; -static int multi; - -void -_threadmultiproc(void) -{ - if(multi == 0){ - multi = 1; - _threadsetproc(theproc); - } -} - -void -_threadsetproc(Proc *p) -{ - int i, h; - Proc **t; - - if(!multi){ - theproc = p; - return; - } - lock(&ptablock); - p->procid = procid(); - h = p->procid%PTABHASH; - for(i=0; iprocid == id){ - unlock(&ptablock); - return t; - } - } - return nil; -} - -Proc* -_threadgetproc(void) -{ - Proc **t; - - t = _threadfindproc(procid()); - if(t == nil) - return nil; - return *t; -} - -Proc* -_threaddelproc(void) -{ - Proc **t, *p; - - t = _threadfindproc(procid()); - if(t == nil) - return nil; - p = *t; - *t = T; - return p; -} -- cgit v1.2.3