Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 10 Aug 2023 10:06:17 -0400
From: "Alex Xu (Hello71)" <alex_y_xu@...oo.ca>
To: qijinquan@...hong.com
Cc: musl@...ts.openwall.com
Subject: Re: pthread_cond_wait may has a error

Excerpts from 祁金全's message of August 10, 2023 2:22 am:
> Hi,
> In my demo, I create 3 threads, the first and the second thread are wait for the global pthread_cond with different pthread_mutex

https://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_cond_wait.html:
> The effect of using more than one mutex for concurrent 
> pthread_cond_wait() or pthread_cond_timedwait() operations on the same 
> condition variable is undefined

https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_timedwait.html:
> When a thread waits on a condition variable, having specified a 
> particular mutex to either the pthread_cond_timedwait() or the 
> pthread_cond_wait() operation, a dynamic binding is formed between 
> that mutex and condition variable that remains in effect as long as at 
> least one thread is blocked on the condition variable. During this 
> time, the effect of an attempt by any thread to wait on that condition 
> variable using a different mutex is undefined.

Cheers,
Alex.

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.