# This file contains suppressions for Thread Sanitizer.
# For the specification, refer to: https://github.com/google/sanitizers/wiki/threadsanitizersuppressions



## Set/Wait
# This provides synchronization equivalent to a lock, but Thread Sanitizer cannot recognize it.

# Thread Sanitizer reports data race on Halt in TK64.
# https://github.com/SoftEtherVPN/SoftEtherVPN/pull/2221
race_top:FreeTick64

# Thread Sanitizer reports data races on Finished and NoDelayFlag in CONNECT_SERIAL_PARAM,
# shared between BindConnectThreadForIPv4, BindConnectThreadForIPv6, and BindConnectEx5.
# https://github.com/SoftEtherVPN/SoftEtherVPN/pull/2222
race_top:BindConnectThreadForIPv4
race_top:BindConnectThreadForIPv6
race_top:BindConnectEx5

# Thread Sanitizer reports data races on PoolHalting in THREAD, shared between ThreadPoolProc and WaitThread.
# But if WaitThread reads false, synchronization is ensured by Wait from the PoolWaitList. If it reads true,
# WaitThread simply returns.
race_top:ThreadPoolProc


## Accept/Disconnect cancellation
# Thread Sanitizer reports two data races on CancelAccept and CallingThread in SOCK, shared between
# Accept(Accept6) and Disconnect. These are used when interrupting an Accept operation from a Disconnect.
# They are race-safe because they work correctly even if both fields have old values.
race_top:^Accept$
race_top:^Accept6$
race_top:^Disconnect$


## Manual PTHREAD_MUTEX_RECURSIVE
# 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). While Thread Sanitizer will report data races,
# these warnings should be ignored as the logic has been carefully implemented to ensure thread safety.
# https://github.com/SoftEtherVPN/SoftEtherVPN/pull/2219
race_top:UnixLock
race_top:UnixUnlockEx
