From: Noel Grandin <noelgrandin@gmail.com>
To: Bruno Haible <bruno@clisp.org>,
Takashi Yano <takashi.yano@nifty.ne.jp>,
cygwin@cygwin.com
Subject: Re: [PATCH v2] Cygwin: pthread: Fix a race issue introduced by the commit 2c5433e5da82
Date: Thu, 30 May 2024 12:28:16 +0200 [thread overview]
Message-ID: <233f8671-c1af-4587-bb83-a206a7e90090@gmail.com> (raw)
In-Reply-To: <2073558.3YGTXZJOeS@nimes>
On 5/30/2024 11:15 AM, Bruno Haible wrote:
>
> Still: Does ReleaseSRWLockExclusive notify other threads?
>
Of course? How else would a lock work, it must release other waiters?
It might not be a fair lock though, which is not a problem for this situation, which does not require fair locking.
> Functionally, the INIT_ONCE looks interesting. But, like Takashi Yano mentioned,
> how would you make it fit into a pthread_once_t that is defined as
> struct { pthread_mutex_t mutex; int state; }
> ?
Something like:
struct once {
union {
pthread_mutex_t old_mutex_field_for_size_compatibility;
SRWLOCK lock = SRWLOCK_INIT;
};
int state;
};
Regards, Noel Grandin
next prev parent reply other threads:[~2024-05-30 10:28 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240530050538.53724-1-takashi.yano@nifty.ne.jp>
[not found] ` <0126a98a-3bdc-4303-a0d2-09f4c7009392@gmail.com>
2024-05-30 8:47 ` Bruno Haible
2024-05-30 8:59 ` Noel Grandin
2024-05-30 9:15 ` Bruno Haible
2024-05-30 10:28 ` Noel Grandin [this message]
2024-05-30 13:53 ` SRW locks Bruno Haible
2024-05-30 10:14 ` [PATCH v2] Cygwin: pthread: Fix a race issue introduced by the commit 2c5433e5da82 Bruno Haible
[not found] ` <20240530205012.2aff4d507acac144e50df2a4@nifty.ne.jp>
[not found] ` <20240530205918.7c730117b567bb3bec3a0c3f@nifty.ne.jp>
2024-05-30 13:38 ` Bruno Haible
2024-05-31 14:01 ` Bruno Haible
2024-06-01 14:18 ` Takashi Yano
2024-06-01 16:08 ` Ken Brown
2024-06-01 21:11 ` Takashi Yano
2024-06-02 13:14 ` Bruno Haible
2024-06-02 14:27 ` Takashi Yano
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=233f8671-c1af-4587-bb83-a206a7e90090@gmail.com \
--to=noelgrandin@gmail.com \
--cc=bruno@clisp.org \
--cc=cygwin@cygwin.com \
--cc=takashi.yano@nifty.ne.jp \
/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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).