[Prev][Next][Index][Thread]

condition vars



Hi, I'm working on a kernel to solve the readers writer's problem with 
reader's priority and I'm running into a problem with the functionality 
of the condition variables.  Okay here's the situation... 
 
After a writer process writes to the file, in it's endWrite() monitor 
procedure it needs to see if there are any reader processes waiting on 
their condition variables.  If there aren't then wake up a writer 
process waiting on its condition variable. 
 
So, how can I tell if there are reader processes waiting on a condition 
variable? 
 
Here's what I had, but it doesn't work... 
 
 if (pthread_cond_signal(&OKtoRead) != 0) { 
      pthread_cond_signal(&OKtoWrite); 
 } 
 
I thought maybe pthread_cond_signal would return a non-zero value if 
there are no waiting threads, but I guess not. 
 
Thanks in advance.



-----------------------------------
This message was sent with the demo version of Postmaster, a BeOS mail client.
For more information, please visit http://kennyc.com/postmaster