This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
I am using a benchmark which is associating multiple mutex variables with a single condition variable to achieve a very particular functionality like a barrier. The control flow is that there are more than one worker thread working on their own individual work queue. Each thread is waiting on the same condition variable, but use a thread specific mutex variable with the condition wait. The event handler thread queues work for the set of worker threads and broadcast on the common condition variable. When the worker threads come out of the wait they check their queue for new work, if empty they wait on the condition variable again. The benchmark works predictably on each run, but I believe it is violating what the man page states on how condition wait works. Quoting from the man page: "The effect of using more than one mutex for concurrent pthread_cond_timedwait() or pthread_cond_wait() operations on the same condition variable is undefined; that is, a condition variable becomes bound to a unique mutex when a thread waits on the condition variable, and this (dynamic) binding shall end when the wait returns." I am wondering if the behavior of the benchmark is correct. Regards, Bharath
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |