]> Savannah Git Hosting - gnulib.git/commit
windows-once: Free allocated resources when done.
authorBruno Haible <bruno@clisp.org>
Thu, 30 May 2024 08:23:22 +0000 (10:23 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 30 May 2024 08:23:45 +0000 (10:23 +0200)
commit4fded4cbf3a395af794704c236467904b111fa74
tree06ae4e148373a0911d2c1cce3f7701921aec1454
parent31e0143259f96fa5491a4216d0975e71f87ec03b
windows-once: Free allocated resources when done.

Based on an observation regarding Cygwin's pthread_once implementation
by Takashi Yano <takashi.yano@nifty.ne.jp> at
<https://cygwin.com/pipermail/cygwin/2024-January/255182.html> and
<https://cygwin.com/pipermail/cygwin-patches/2024q1/012600.html>

* lib/windows-once.h (glwthread_once_t): Add field 'num_threads'.
(GLWTHREAD_ONCE_INIT): Initialize it to zero.
* lib/windows-once.c (glwthread_once): Increment num_threads while the
thread uses the lock. Let the last thread that uses the lock destroy it.
ChangeLog
lib/windows-once.c
lib/windows-once.h