]> Savannah Git Hosting - gnulib.git/commit
windows-mutex, windows-timedmutex: Follow pthread_mutex_trylock spec.
authorBruno Haible <bruno@clisp.org>
Tue, 6 Aug 2024 13:14:25 +0000 (15:14 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 6 Aug 2024 13:14:25 +0000 (15:14 +0200)
commit0cd5825421831dc132e335a5b5cd7648bb2e334e
treef551548ec471c1f13c5794a9c0de4f8856a0e06f
parent884f4f3a924cef077e4bf0e488946a6b7cf5515e
windows-mutex, windows-timedmutex: Follow pthread_mutex_trylock spec.

* lib/windows-mutex.h (glwthread_mutex_t): Add 'owner' field.
* lib/windows-mutex.c: Include <stdlib.h>.
(glwthread_mutex_lock): Set the 'owner' field after entering the
critical section.
(glwthread_mutex_trylock): Detect whether the lock was previously locked
by this thread. Set the 'owner' field after entering the critical
section.
(glwthread_mutex_unlock): Clear the 'owner' field before leaving the
critical section.
* lib/windows-timedmutex.h (glwthread_timedmutex_t): Add 'owner' field.
* lib/windows-timedmutex.c: (glwthread_timedmutex_lock): Set the 'owner'
field after entering the critical section.
(glwthread_timedmutex_trylock): Detect whether the lock was previously
locked by this thread. Set the 'owner' field after entering the critical
section.
(glwthread_timedmutex_unlock): Clear the 'owner' field before leaving
the critical section.
ChangeLog
lib/windows-mutex.c
lib/windows-mutex.h
lib/windows-timedmutex.c
lib/windows-timedmutex.h