]> 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:29:18 +0000 (18:29 +0000)
commit9afa54b3b38b64760d60d8a00220f0c99cca1c7f
treee504ce20822b2e48bfa7150c114c80afd104ce86
parent97674e1d20c241df06cfd2194c905ceb73f9eb91
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 7e2243f9e1f1ccfe766ea27a0d31329cf016a8eb)
build_tools/cflags-devmode.xml
include/asterisk/lock.h
main/lock.c