Locking: Add basic reactive deadlock detection foundation

We added a timestamp to each Lockvoker so that we can detect when
a lockvoker has been in a qutex for "too long", where "too long"
is defined arbitrarily as 500ms.

Next we're going to change the way we create callbacks to enable
us to more explicitly access the sh_ptr<AsyncContin> via
the callback object.
This commit is contained in:
2025-09-22 20:45:36 -04:00
parent d2ed525106
commit 092a0954a0
5 changed files with 53 additions and 31 deletions
+11 -7
View File
@@ -3,6 +3,7 @@ project(salmanoff VERSION 0.00.004 LANGUAGES CXX)
include(CMakeDependentOption)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/DAPSS.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/DebugOpts.cmake)
# Set C++ standard
set(CMAKE_CXX_STANDARD 20)
@@ -27,16 +28,19 @@ math(EXPR MIND_VOSCILLATOR_FREQ_MS "1000 / ${MIND_VOSCILLATOR_PERIOD_MS}")
option(WORLD_USE_BODY_THREAD
"Use body thread for world component instead of separate world thread" OFF)
# Qutex deadlock detection configuration
set(DEBUG_CONFIG_QUTEX_DEADLOCK_TIMEOUT_MS 500 CACHE STRING
"Timeout in milliseconds for deadlock detection in qutex system")
if(NOT DEBUG_CONFIG_QUTEX_DEADLOCK_TIMEOUT_MS GREATER 0)
message(FATAL_ERROR "DEBUG_CONFIG_QUTEX_DEADLOCK_TIMEOUT_MS must be a positive integer > 0")
endif()
# Test configuration
option(ENABLE_TESTS "Enable building tests" OFF)
# Set the debug locks variable for config.h
if(ENABLE_DEBUG_LOCKS)
set(CONFIG_ENABLE_DEBUG_LOCKS TRUE)
else()
set(CONFIG_ENABLE_DEBUG_LOCKS FALSE)
endif()
# Set the timeout variable for config.h
set(CONFIG_DEBUG_QUTEX_DEADLOCK_TIMEOUT_MS ${DEBUG_QUTEX_DEADLOCK_TIMEOUT_MS})
# Configure config.h
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/include/config.h.in