haiku/headers
Augustin Cavalier fd161d7bf2 kernel/locks: Remove ignore_unlock_count and fix races in lock timeout.
As far as I can tell, there is no reason to ignore unlocks, ever;
if no threads are waiting, then mutex_unlock() will act appropriately.
So all we need to do is increment the lock's count here,
as we are relinquishing our request for locking.

On the other hand, if we did not find our structure in the lock,
that means we own the lock; so to return with an error from here
without changing the count would result in a deadlock, as the lock
would then be ours, despite our error code implying otherwise.

Additionally, take care of part of the case where we have woken up
by mutex_destroy(), by setting thread to NULL and checking for it
in that case. There is still a race here, however.

May fix #16044, as it appears there is a case where ACPICA
calls this with a timeout of 0 (we should make this be
a mutex_trylock, anyway.)

Change-Id: I98215df218514c70ac1922bc3a6f10e01087e44b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2716
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-05-17 00:22:15 +00:00
..
build configure & build: Add basic support for building with MSYS. 2020-05-03 13:24:26 -04:00
compatibility Add missing include in bsd/sys/link_elf.h 2019-09-18 03:40:47 +00:00
config ARM64: Initial changes so we can compile GCC toolchain 2019-08-30 19:05:16 +00:00
cpp build fix. 2015-11-12 22:24:16 +01:00
glibc
libs agg: fix build. 2020-01-22 19:25:16 +01:00
os SeparatorItem: support horizontal layout 2020-05-10 15:45:27 +00:00
posix uchar.h: Remove duplicate definition of mbrtoc32. 2020-05-09 16:15:55 -04:00
private kernel/locks: Remove ignore_unlock_count and fix races in lock timeout. 2020-05-17 00:22:15 +00:00
tools Fix #12799: Enable elf symbol patching for Haiku 2016-10-30 10:42:24 +01:00