diff options
author | rsc <devnull@localhost> | 2004-09-17 00:38:29 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-09-17 00:38:29 +0000 |
commit | 06bb4ed20d855b60e39c1125d8d715ba8892265b (patch) | |
tree | 8294b537f5b81809671985903e31c4835c41cd04 /src/libthread/sched.c | |
parent | 984e353160593b20d1e2944e1f2e9ce2117c8490 (diff) | |
download | plan9port-06bb4ed20d855b60e39c1125d8d715ba8892265b.tar.gz plan9port-06bb4ed20d855b60e39c1125d8d715ba8892265b.tar.bz2 plan9port-06bb4ed20d855b60e39c1125d8d715ba8892265b.zip |
Rewrite to remove dependence on rendezvous and its bizarre
data structures. Makes it easier to use pthreads too.
Still need to add code for non-pthreads systems.
Just a checkpoint to switch work to another machine.
Diffstat (limited to 'src/libthread/sched.c')
-rw-r--r-- | src/libthread/sched.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libthread/sched.c b/src/libthread/sched.c index df8014b6..f9e680fd 100644 --- a/src/libthread/sched.c +++ b/src/libthread/sched.c @@ -36,6 +36,7 @@ _schedinit(void *arg) unlock(&p->lock); while(_setlabel(&p->sched)) ; +malloc(10); _threaddebug(DBGSCHED, "top of schedinit, _threadexitsallstatus=%p", _threadexitsallstatus); if(_threadexitsallstatus) _exits(_threadexitsallstatus); @@ -57,8 +58,9 @@ _schedinit(void *arg) p->threads.tail = t->prevt; unlock(&p->lock); if(t->inrendez){ - _threadflagrendez(t); - _threadbreakrendez(); + abort(); + // _threadflagrendez(t); + // _threadbreakrendez(); } _stackfree(t->stk); free(t->cmdname); @@ -183,15 +185,18 @@ _sched(void) Resched: p = _threadgetproc(); //fprint(2, "p %p\n", p); +malloc(10); if((t = p->thread) != nil){ needstack(512); // _threaddebug(DBGSCHED, "pausing, state=%s set %p goto %p", // psstate(t->state), &t->sched, &p->sched); +print("swap\n"); if(_setlabel(&t->sched)==0) _gotolabel(&p->sched); _threadstacklimit(t->stk, t->stk+t->stksize); return p->nsched++; }else{ +malloc(10); t = runthread(p); if(t == nil){ _threaddebug(DBGSCHED, "all threads gone; exiting"); @@ -206,6 +211,8 @@ Resched: } t->state = Running; t->nextstate = Ready; +malloc(10); +print("gotolabel\n"); _gotolabel(&t->sched); for(;;); } |