]> 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>
Mon, 12 Aug 2024 17:12:41 +0000 (19:12 +0200)
commit45e3fa16bd9c0f910aac76f7ee02ddf86569daa9
tree6860f405d71fc98915e4ece7bb76149fa2370b88
parent14a3d1529c4068a069ab046517fba9af68f7b3d1
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