Comment 2 for bug 1450355

Revision history for this message
junyer (junyer) wrote :

Note that the second case hung and thus required me to hit Ctrl-C.

The proximate cause seems to be that the TID (Thread ID) in the TLS (Thread-Local Storage) is not initialised properly:

1. The first pthread_rwlock_wrlock() call sets __writer to the TID, which is 0.
2. The first pthread_rwlock_unlock() call thinks that we had a reader lock because __writer is 0, so it decrements __nr_readers from 0 to 4294967295.
3. The second pthread_rwlock_wrlock() call hangs because it's waiting forever to be woken by a reader that never existed.