Cygwin: pthread: Fix handle leak in pthread_once.
commit2c5433e5da8216aaf7458e50c63683c68fb0d3e8
authorTakashi Yano <takashi.yano@nifty.ne.jp>
Wed, 24 Jan 2024 13:33:12 +0000 (24 22:33 +0900)
committerTakashi Yano <takashi.yano@nifty.ne.jp>
Wed, 24 Jan 2024 13:42:49 +0000 (24 22:42 +0900)
tree67d7bcaafbdaca3d06ca1db489d3ea8496208477
parent15140d6df667a71e660dc9da9ca9071fa3c5dbbd
Cygwin: pthread: Fix handle leak in pthread_once.

If pthread_once() is called with pthread_once_t initialized using
PTREAD_ONCE_INIT, pthread_once does not release pthread_mutex used
internally. This patch fixes that by calling pthread_mutex_destroy()
in the thread which has called init_routine.

Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
winsup/cygwin/thread.cc