mailing list of musl libc
 help / color / mirror / code / Atom feed
From: "Alex Xu (Hello71)" <alex_y_xu@yahoo.ca>
To: qijinquan@kaihong.com
Cc: musl@lists.openwall.com
Subject: Re: [musl] pthread_cond_wait may has a error
Date: Thu, 10 Aug 2023 10:06:17 -0400	[thread overview]
Message-ID: <1691676230.gfmh0cw839.none@localhost> (raw)
In-Reply-To: <73135a17-ed7a-4749-aa6e-75faa1c85077.qijinquan@kaihong.com>

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.

  reply	other threads:[~2023-08-10 14:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-10  6:22 祁金全
2023-08-10 14:06 ` Alex Xu (Hello71) [this message]
2023-08-10 21:52 ` Patrick Oppenlander

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1691676230.gfmh0cw839.none@localhost \
    --to=alex_y_xu@yahoo.ca \
    --cc=musl@lists.openwall.com \
    --cc=qijinquan@kaihong.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).