From 93bf90ba95c805d6ab4b93f186bf2f5e02924217 Mon Sep 17 00:00:00 2001 From: synqa Date: Thu, 19 Feb 2026 17:44:38 +0900 Subject: [PATCH] Add comment for UnixLock The Lock/Unlock mechanism on Unix is a manual, hand-coded implementation of PTHREAD_MUTEX_RECURSIVE. We avoid using the PTHREAD_MUTEX_RECURSIVE directly because it exhibits critical bugs, such as deadlocks on certain older systems(Linux, Solaris, or macOS). followup #2219 --- src/Mayaqua/Unix.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Mayaqua/Unix.c b/src/Mayaqua/Unix.c index 84da9326..dbdb5e47 100644 --- a/src/Mayaqua/Unix.c +++ b/src/Mayaqua/Unix.c @@ -1849,6 +1849,8 @@ void UnixUnlockEx(LOCK *lock, bool inner) } // Lock +// Recursive locking is implemented manually instead of using PTHREAD_MUTEX_RECURSIVE. +// See: https://github.com/SoftEtherVPN/SoftEtherVPN/pull/2219 bool UnixLock(LOCK *lock) { pthread_mutex_t *mutex;