apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Victor J. Orlikowski" <v.j.orlikow...@gte.net>
Subject Re: Conditionals...
Date Thu, 02 Aug 2001 16:35:09 GMT
 > 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!
==================================================================
v.j.orlikowski@gte.net | orlikowski@apache.org | vjo@us.ibm.com

Mime
View raw message