[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-bugs] #16644 [Tor]: Unpredictable scheduling behavior of threads
#16644: Unpredictable scheduling behavior of threads
-------------------------+------------------------------------
Reporter: cypherpunks | Owner:
Type: defect | Status: new
Priority: minor | Milestone:
Component: Tor | Version: Tor: 0.2.6.3-alpha
Keywords: | Actual Points:
Parent ID: | Points:
-------------------------+------------------------------------
The
[http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_broadcast.html
POSIX standard] states
>The pthread_cond_broadcast() or pthread_cond_signal() functions may be
called by a thread whether or not it currently owns the mutex that threads
calling pthread_cond_wait() or pthread_cond_timedwait() have associated
with the condition variable during their waits; '''''however, if
predictable scheduling behavior is required, then that mutex shall be
locked by the thread calling pthread_cond_broadcast() or
pthread_cond_signal()'''''.
The highlighted recommendation isn't followed in by some thread pool
functions which release the mutex before unblocking the threads. The issue
was found using Helgrind (a Valgrind tool) which gave the warning `Thread
#1: pthread_cond_{signal,broadcast}: dubious: associated lock is not held
by any thread`
It is worth mentioning that the thread tests do follow the recommendation.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/16644>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs