public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Kaz Kylheku <kaz@kylheku.com>
To: Takashi Yano <takashi.yano@nifty.ne.jp>
Cc: cygwin@cygwin.com
Subject: Re: Possiblly bug of cygwin1.dll
Date: Wed, 24 Jan 2024 12:08:42 -0800	[thread overview]
Message-ID: <69bed0a96ffea6cefae1b95d1c9f67a7@kylheku.com> (raw)
In-Reply-To: <20240124205514.eaaa7162e3e858cbb39f5801@nifty.ne.jp>

On 2024-01-24 03:55, Takashi Yano via Cygwin wrote:
> Are there any code examples that use PTHREAD_MUTEX_INITIALIZER
> with pthread_mutex_destroy()?

I don't think I've seen one.

I think they are rare in the field, precisely because
PTHREAD_MUTEX_INITIALIZER is mainly used in C code to
"initialize and forget" global mutexes, so they are ready
before the first thread is every created (and before main
is even called).

Nobody cares about destruction of global mutexes in an executable
(not shared library).

>> Use of the initializer is not restricted to static objects
>> by any normative wording.
> 
> It seems that I had read the older POSIX document.
> 
> https://pubs.opengroup.org/onlinepubs/007904875/functions/pthread_mutex_destroy.html

Aha! OK!

Because I had a memory of there had been something about a static restriction.

I took it for granted you were right about that, and was looking at that for other reasons.

So, good, that is gone. It never made sense anyway.

Pairing the initializer with the destructor call can be done in all situations now.

      parent reply	other threads:[~2024-01-24 20:08 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-19 13:44 Takashi Yano
2024-01-19 14:28 ` Corinna Vinschen
2024-01-20  4:18   ` Takashi Yano
2024-01-20  5:13     ` Takashi Yano
2024-01-20  9:13       ` ASSI
2024-01-20 12:24         ` Takashi Yano
2024-01-20 12:46           ` ASSI
2024-01-21 11:10           ` Takashi Yano
2024-01-21 13:30             ` ASSI
2024-01-22  3:30               ` Takashi Yano
2024-01-22  9:25                 ` Corinna Vinschen
2024-01-22  9:57                   ` Corinna Vinschen
2024-01-22 11:16                     ` Takashi Yano
2024-01-22 11:49                       ` Corinna Vinschen
2024-01-22 12:41                         ` ASSI
2024-01-22 14:54                           ` Corinna Vinschen
2024-01-22 11:06                   ` Takashi Yano
2024-01-22 11:42                     ` Corinna Vinschen
2024-01-23  3:24     ` Kaz Kylheku
2024-01-24 11:55       ` Takashi Yano
2024-01-24 13:05         ` Corinna Vinschen
2024-01-24 13:11           ` Corinna Vinschen
2024-01-24 20:37             ` Kaz Kylheku
2024-01-24 20:08         ` Kaz Kylheku [this message]

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=69bed0a96ffea6cefae1b95d1c9f67a7@kylheku.com \
    --to=kaz@kylheku.com \
    --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).