]> git.ipfire.org Git - thirdparty/asterisk.git/commit
lock.c: Separate DETECT_DEADLOCKS from DEBUG_THREADS
authorGeorge Joseph <gjoseph@sangoma.com>
Wed, 13 Sep 2023 15:18:04 +0000 (09:18 -0600)
committerAsterisk Development Team <asteriskteam@digium.com>
Fri, 12 Jan 2024 18:32:12 +0000 (18:32 +0000)
commit75bb76528ad03f1b24c7d53f561a5dad1be76438
tree9857403645d3f3afa484124018270bf7bb986610
parentfe1bca6a726c1964dac260a0a81ac7f9fe1932d5
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 e1050b4add81f3c4ab7e2eb1511747bef1a9321b)
build_tools/cflags-devmode.xml
include/asterisk/lock.h
main/lock.c