Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn lock-checking on only when assertions are enabled #trivial #1032

Merged
merged 1 commit into from
Jul 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Source/Details/ASThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,19 @@ ASDISPLAYNODE_INLINE void _ASUnlockScopeCleanup(id<NSLocking> __strong *lockPtr)
#define TIME_LOCKER 0
/**
* Enable this flag to collect information on the owning thread and ownership level of a mutex.
* These properties are useful to determine if a mutext has been acquired and in case of a recursive mutex, how many times that happened.
* These properties are useful to determine if a mutex has been acquired and in case of a recursive mutex, how many times that happened.
*
* This flag also enable locking assertions (e.g ASAssertUnlocked(node)).
* The assertions are useful when you want to indicate and enforce the locking policy/expectation of methods.
* To determine when and which methods acquired a (recursive) mutex (to debug deadlocks, for example),
* put breakpoints at some assertions. When the breakpoints hit, walk through stack trace frames
* and check ownership count of the mutex.
*/
#if ASDISPLAYNODE_ASSERTIONS_ENABLED
#define CHECK_LOCKING_SAFETY 1
#else
#define CHECK_LOCKING_SAFETY 0
#endif

#if TIME_LOCKER
#import <QuartzCore/QuartzCore.h>
Expand Down