> void Wait(struct Condition *c) {
        if (c->thread_id != thread_id_of(current_thread))
            exit(-1); /* Only the holder of the lock may call wait */
 >      acquire(c->condlock);
 >      l->thread_id = -1; /* or whatever invalid thread value */
 >      release(c->condlock);
 >      release(*(c->lock));
 >      wait_on_signal_or_broadcast(); /* hint, use a semaphore */
 >      acquire(*(c->lock));
 >      acquire(c->condlock);
 >      c->thread_id = thread_id_of(current_thread);
 >      release(c->condlock);
 > }

And the above would be slightly better.

Victor
-- 
Victor J. Orlikowski   | The Wall is Down, But the Threat Remains!
==================================================================
[EMAIL PROTECTED] | [EMAIL PROTECTED] | [EMAIL PROTECTED]

Reply via email to