4 #include "threadimpl.h"
10 finish(Thread *t, void *val)
16 while(t->state == Running)
19 if(t->state == Rendezvous){ /* not always true: might be Dead */
23 unlock(&t->proc->lock);
28 _threadrendezvous(void *tag, void *val)
33 lock(&_threadrgrp.lock);
34 l = &_threadrgrp.hash[((uintptr)tag)%nelem(_threadrgrp.hash)];
35 for(t=*l; t; l=&t->rendhash, t=*l){
37 _threaddebug(DBGREND, "Rendezvous with thread %d.%d", t->proc->pid, t->id);
40 unlock(&_threadrgrp.lock);
45 /* Going to sleep here. */
46 t = _threadgetproc()->thread;
53 t->nextstate = Rendezvous;
54 _threaddebug(DBGREND, "Rendezvous for tag %p", t->rendtag);
55 unlock(&_threadrgrp.lock);
58 _threaddebug(DBGREND, "Woke after rendezvous; val is %p", t->rendval);
63 * This is called while holding _threadpq.lock and p->lock,
64 * so we can't lock _threadrgrp.lock. Instead our caller has
65 * to call _threadbreakrendez after dropping those locks.
68 _threadflagrendez(Thread *t)
75 _threadbreakrendez(void)
82 lock(&_threadrgrp.lock);
84 unlock(&_threadrgrp.lock);
88 for(i=0; i<nelem(_threadrgrp.hash); i++){
89 l = &_threadrgrp.hash[i];
98 unlock(&_threadrgrp.lock);