Commit Graph

5 Commits

Author SHA1 Message Date
iabdalkader
9beb565882 common/mutex: Return true, if unlocked.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-09-19 00:06:15 +02:00
iabdalkader
1b59e95162 Revert "common/mutex: Clear tid when releasing mutex"
This reverts commit bb52288561.

Event though this fixes a deadlock in the new protocol, it
actually breaks fair locking as one side could lock multiple
times in a row.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-09-13 10:52:00 +02:00
iabdalkader
bb52288561 common/mutex: Clear tid when releasing mutex
Clear the thread ID to 0 when unlocking the mutex to prevent deadlock.
If the thread holding never reacquire it, other threads would be
permanently blocked with a stale thread ID.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-09-12 18:00:32 +02:00
iabdalkader
2c4b318ff9 common/mutex: Use C11 atomic operations.
Use C11 atomic operations to implement the mutex instead
of hard-coded intrinsics. This generates more efficient
assembly on newer ARM architectures by taking advantage
of the new LDA/STL instructions (and their exclusive variants),
which avoid full memory barriers while still providing
memory ordering guarantees.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-07-25 20:20:54 +02:00
iabdalkader
daf2bb30da misc: Restructure repo.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-04-13 08:28:34 +02:00