From 27bebeb702cb726788085bfb0baaf21ccf49abe6 Mon Sep 17 00:00:00 2001 From: Hayodea Hakol Date: Mon, 22 Sep 2025 21:30:14 -0400 Subject: [PATCH] Squash: Into debug locks commit --- cmake/DebugOpts.cmake | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 cmake/DebugOpts.cmake diff --git a/cmake/DebugOpts.cmake b/cmake/DebugOpts.cmake new file mode 100644 index 0000000..4e8dcc0 --- /dev/null +++ b/cmake/DebugOpts.cmake @@ -0,0 +1,22 @@ +# DebugOpts.cmake - Debug configuration options + +# Enable debug locking features +option(ENABLE_DEBUG_LOCKS "Enable debug features for locking system" ON) + +# Qutex deadlock detection configuration +# Always define the variable in cache so it appears in ccmake +set(DEBUG_QUTEX_DEADLOCK_TIMEOUT_MS 500 CACHE STRING + "Timeout in milliseconds for deadlock detection in qutex system") + +if(ENABLE_DEBUG_LOCKS) + # Validate the timeout value + if(NOT DEBUG_QUTEX_DEADLOCK_TIMEOUT_MS OR DEBUG_QUTEX_DEADLOCK_TIMEOUT_MS STREQUAL "") + message(FATAL_ERROR "DEBUG_QUTEX_DEADLOCK_TIMEOUT_MS must be a positive integer > 0") + endif() + + # Convert to integer and validate + math(EXPR timeout_int "${DEBUG_QUTEX_DEADLOCK_TIMEOUT_MS}") + if(timeout_int LESS_EQUAL 0) + message(FATAL_ERROR "DEBUG_QUTEX_DEADLOCK_TIMEOUT_MS must be a positive integer > 0") + endif() +endif()