diff options
| author | rsc <devnull@localhost> | 2004-05-11 17:51:27 +0000 |
|---|---|---|
| committer | rsc <devnull@localhost> | 2004-05-11 17:51:27 +0000 |
| commit | c4097c29512269f4547ebefb8abdc57a2892b479 (patch) | |
| tree | e84c61a845b196bfa903088e15b772ae0b16c8bb /src/libthread/sched.c | |
| parent | 2f2df5e02ef22c9727ae2b8269d5c76a061d296f (diff) | |
| download | plan9port-c4097c29512269f4547ebefb8abdc57a2892b479.tar.gz plan9port-c4097c29512269f4547ebefb8abdc57a2892b479.zip | |
Fix small bugs.
Diffstat (limited to 'src/libthread/sched.c')
| -rw-r--r-- | src/libthread/sched.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/libthread/sched.c b/src/libthread/sched.c index 9ad7298b..bdb9ad6b 100644 --- a/src/libthread/sched.c +++ b/src/libthread/sched.c @@ -171,7 +171,7 @@ needstack(int howmuch) } } -void +int _sched(void) { Proc *p; @@ -186,8 +186,8 @@ Resched: // psstate(t->state), &t->sched, &p->sched); if(_setlabel(&t->sched)==0) _gotolabel(&p->sched); - _threadstacklimit(t->stk); - return; + _threadstacklimit(t->stk, t->stk+t->stksize); + return p->nsched++; }else{ t = runthread(p); if(t == nil){ @@ -277,10 +277,15 @@ _threadidle(void) unlock(&p->readylock); } -void +int yield(void) { - _sched(); + Proc *p; + int nsched; + + p = _threadgetproc(); + nsched = p->nsched; + return _sched() - nsched; } void |
