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 Sat, 11 Aug 2001 20:05:54 GMT
Urgh...
Variable reuse, Victor, variable reuse.
<Victor hits head on desk, noting that he was obviously on vacation.>

> int Acquire_Condition_Lock(struct Condition *c) {
>       int thrid = thread_id_of(current_thread);
>       if (c->thread_id == thrid) exit(1);  /* Deadlock */
>       acquire(*(c->lock));
>       acquire(c->condlock);
>       c->thread_id = thread_id_of(current_thread);
>       release(c->condlock);
>       return 0;
> }
> 

Make that:

int Acquire_Condition_Lock(struct Condition *c) {
      int thrid = thread_id_of(current_thread);
      if (c->thread_id == thrid) exit(1);  /* Deadlock */
      acquire(*(c->lock));
      acquire(c->condlock);
      c->thread_id = thrid;
      release(c->condlock);
      return 0;
}

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