diff options
| author | rsc <devnull@localhost> | 2004-11-08 16:04:01 +0000 |
|---|---|---|
| committer | rsc <devnull@localhost> | 2004-11-08 16:04:01 +0000 |
| commit | 24f4e66b12cf0501d0f239ade10b2963f46e6755 (patch) | |
| tree | 6fb79980edf83c07bba66b7303dde8874c6d7e33 /src/libthread/setproc.c | |
| parent | cf4f3eafc6016ccdb57773215dcdd5ebac95c07d (diff) | |
| download | plan9port-24f4e66b12cf0501d0f239ade10b2963f46e6755.tar.gz plan9port-24f4e66b12cf0501d0f239ade10b2963f46e6755.zip | |
still more files
Diffstat (limited to 'src/libthread/setproc.c')
| -rw-r--r-- | src/libthread/setproc.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/libthread/setproc.c b/src/libthread/setproc.c new file mode 100644 index 00000000..5f1e2a8d --- /dev/null +++ b/src/libthread/setproc.c @@ -0,0 +1,36 @@ +/* + * Avoid using threading calls for single-proc programs. + */ + +#include "threadimpl.h" + +static int multi; +static Proc *theproc; + +void +_threadsetproc(Proc *p) +{ + if(!multi) + theproc = p; + else + _kthreadsetproc(p); +} + +Proc* +_threadgetproc(void) +{ + if(!multi) + return theproc; + return _kthreadgetproc(); +} + +void +_threadmultiproc(void) +{ + if(multi) + return; + + multi = 1; + _kthreadinit(); + _threadsetproc(theproc); +} |
