[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: problems with pthread_cond_broadcast

On Apr 15, 2004, at 2:48 AM, Thorsten Kukuk wrote:

On Thu, Apr 15, Scott Lamb wrote:

I think there is a problem in your test case. And I _sort_of_ see it.
Imagine this sequence of events:

Thread 1            Thread 2
rw_lock_write:      rw_lock_write:
  n_readers = -1
                      n_readers != 0

At this place, two threads would have mutex_lock. That should not happen and I don't see how it can happen.

Indeed. Sorry, I blame a cut'n'paste accident. Trying to come up with the correct sequence. I thought I had it at one point, anyway. Grr.

What I'm looking for, though, is a situation where thread 1's pthread_cond_broadcast is after thread 2's n_readers != 0 comparison yet before thread 2's pthread_cond_wait. That can't happen when the mutex is still held for the broadcast. I had 3 threads involved before, maybe that is necessary...


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]