lock.c: Separate DETECT_DEADLOCKS from DEBUG_THREADS

Previously, DETECT_DEADLOCKS depended on DEBUG_THREADS.
Unfortunately, DEBUG_THREADS adds a lot of lock tracking overhead
to all of the lock lifecycle calls whereas DETECT_DEADLOCKS just
causes the lock calls to loop over trylock in 200us intervals until
the lock is obtained and spits out log messages if it takes more
than 5 seconds.  From a code perspective, the only reason they were
tied together was for logging.  So... The ifdefs in lock.c were
refactored to allow DETECT_DEADLOCKS to be enabled without
also enabling DEBUG_THREADS.

Resolves: #321

UserNote: You no longer need to select DEBUG_THREADS to use
DETECT_DEADLOCKS.  This removes a significant amount of overhead
if you just want to detect possible deadlocks vs needing full
lock tracing.

(cherry picked from commit e1050b4add)
This commit is contained in:
George Joseph
2023-09-13 09:18:04 -06:00
committed by Asterisk Development Team
parent fe1bca6a72
commit 75bb76528a
3 changed files with 44 additions and 23 deletions

View File

@@ -9,7 +9,6 @@
<support_level>extended</support_level>
</member>
<member name="DETECT_DEADLOCKS" displayname="Detect Deadlocks">
<depend>DEBUG_THREADS</depend>
<support_level>extended</support_level>
</member>
<member name="DUMP_SCHEDULER" displayname="Dump Scheduler Contents for Debugging">