problems with pthread_cond_broadcast

Dinakar Guniguntala dgunigun at
Thu Apr 15 08:10:59 UTC 2004

I believe this problem has been resolved with Update 2 level of NPTL.
(or the current cvs)
Though I really didn't dig deep to see what the problem was

                      Thorsten Kukuk                                                                                                 
                      <kukuk at>          To:       phil-list at                                                        
                      Sent by:                 cc:                                                                                   
                      phil-list-bounces        Subject:  problems with pthread_cond_broadcast                                        
                      04/15/2004 11:20                                                                                               


I have a problem with pthread_cond_wait/pthread_cond_broadcast
waiting sometimes forever on a fast SMP machine. Attached is a
simple test case.

If I use the order
  pthread_mutex_unlock (&lock);
  pthread_cond_broadcast (&pcond);

with NPTL, the program will hang after a short time running with
current glibc + NPTL + kernel 2.6.x on all architectures I tested.

If I revert the order to
  pthread_cond_broadcast (&pcond);
  pthread_mutex_unlock (&lock);

it works fine.

Is this a problem of the test case (since pthread_cond_broadcast and
pthread_cond_wait will access pcond at the same time in different
threads) or is this a glibc/NPTL/kernel problem?

 Thanks for any hint,

Thorsten Kukuk        kukuk at
SuSE Linux AG        Maxfeldstr. 5                 D-90409 Nuernberg
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B

Phil-list mailing list
Phil-list at

#### breaknptl.c has been removed from this note on April 15 2004 by
Dinakar Guniguntala

More information about the Phil-list mailing list