]>
Commit | Line | Data |
---|---|---|
31875a97 A |
1 | /* |
2 | * Copyright (c) 2015 Apple Inc. All Rights Reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * This file contains Original Code and/or Modifications of Original Code | |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. Please obtain a copy of the License at | |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
11 | * file. | |
12 | * | |
13 | * The Original Code and all software distributed under the License are | |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
18 | * Please see the License for the specific language governing rights and | |
19 | * limitations under the License. | |
20 | * | |
21 | * @APPLE_LICENSE_HEADER_END@ | |
22 | */ | |
23 | ||
4a109af3 | 24 | #if LOCKDEBUG |
bd8dfcfc A |
25 | extern void lockdebug_assert_all_locks_locked(); |
26 | extern void lockdebug_assert_no_locks_locked(); | |
34d5b5e8 | 27 | extern void lockdebug_assert_no_locks_locked_except(std::initializer_list<void *> canBeLocked); |
bd8dfcfc A |
28 | extern void lockdebug_setInForkPrepare(bool); |
29 | extern void lockdebug_lock_precedes_lock(const void *oldlock, const void *newlock); | |
30 | #else | |
66799735 A |
31 | static constexpr inline void lockdebug_assert_all_locks_locked() { } |
32 | static constexpr inline void lockdebug_assert_no_locks_locked() { } | |
34d5b5e8 | 33 | static constexpr inline void lockdebug_assert_no_locks_locked_except(std::initializer_list<void *> canBeLocked) { }; |
66799735 A |
34 | static constexpr inline void lockdebug_setInForkPrepare(bool) { } |
35 | static constexpr inline void lockdebug_lock_precedes_lock(const void *, const void *) { } | |
bd8dfcfc A |
36 | #endif |
37 | ||
38 | extern void lockdebug_remember_mutex(mutex_tt<true> *lock); | |
31875a97 A |
39 | extern void lockdebug_mutex_lock(mutex_tt<true> *lock); |
40 | extern void lockdebug_mutex_try_lock(mutex_tt<true> *lock); | |
41 | extern void lockdebug_mutex_unlock(mutex_tt<true> *lock); | |
42 | extern void lockdebug_mutex_assert_locked(mutex_tt<true> *lock); | |
43 | extern void lockdebug_mutex_assert_unlocked(mutex_tt<true> *lock); | |
44 | ||
34d5b5e8 A |
45 | static constexpr inline void lockdebug_remember_mutex(__unused mutex_tt<false> *lock) { } |
46 | static constexpr inline void lockdebug_mutex_lock(__unused mutex_tt<false> *lock) { } | |
47 | static constexpr inline void lockdebug_mutex_try_lock(__unused mutex_tt<false> *lock) { } | |
48 | static constexpr inline void lockdebug_mutex_unlock(__unused mutex_tt<false> *lock) { } | |
49 | static constexpr inline void lockdebug_mutex_assert_locked(__unused mutex_tt<false> *lock) { } | |
50 | static constexpr inline void lockdebug_mutex_assert_unlocked(__unused mutex_tt<false> *lock) { } | |
31875a97 A |
51 | |
52 | ||
bd8dfcfc | 53 | extern void lockdebug_remember_monitor(monitor_tt<true> *lock); |
31875a97 A |
54 | extern void lockdebug_monitor_enter(monitor_tt<true> *lock); |
55 | extern void lockdebug_monitor_leave(monitor_tt<true> *lock); | |
56 | extern void lockdebug_monitor_wait(monitor_tt<true> *lock); | |
57 | extern void lockdebug_monitor_assert_locked(monitor_tt<true> *lock); | |
58 | extern void lockdebug_monitor_assert_unlocked(monitor_tt<true> *lock); | |
59 | ||
34d5b5e8 A |
60 | static constexpr inline void lockdebug_remember_monitor(__unused monitor_tt<false> *lock) { } |
61 | static constexpr inline void lockdebug_monitor_enter(__unused monitor_tt<false> *lock) { } | |
62 | static constexpr inline void lockdebug_monitor_leave(__unused monitor_tt<false> *lock) { } | |
63 | static constexpr inline void lockdebug_monitor_wait(__unused monitor_tt<false> *lock) { } | |
64 | static constexpr inline void lockdebug_monitor_assert_locked(__unused monitor_tt<false> *lock) { } | |
65 | static constexpr inline void lockdebug_monitor_assert_unlocked(__unused monitor_tt<false> *lock) {} | |
31875a97 A |
66 | |
67 | ||
bd8dfcfc A |
68 | extern void |
69 | lockdebug_remember_recursive_mutex(recursive_mutex_tt<true> *lock); | |
31875a97 A |
70 | extern void |
71 | lockdebug_recursive_mutex_lock(recursive_mutex_tt<true> *lock); | |
72 | extern void | |
73 | lockdebug_recursive_mutex_unlock(recursive_mutex_tt<true> *lock); | |
74 | extern void | |
75 | lockdebug_recursive_mutex_assert_locked(recursive_mutex_tt<true> *lock); | |
76 | extern void | |
77 | lockdebug_recursive_mutex_assert_unlocked(recursive_mutex_tt<true> *lock); | |
78 | ||
66799735 | 79 | static constexpr inline void |
34d5b5e8 | 80 | lockdebug_remember_recursive_mutex(__unused recursive_mutex_tt<false> *lock) { } |
66799735 | 81 | static constexpr inline void |
34d5b5e8 | 82 | lockdebug_recursive_mutex_lock(__unused recursive_mutex_tt<false> *lock) { } |
66799735 | 83 | static constexpr inline void |
34d5b5e8 | 84 | lockdebug_recursive_mutex_unlock(__unused recursive_mutex_tt<false> *lock) { } |
66799735 | 85 | static constexpr inline void |
34d5b5e8 | 86 | lockdebug_recursive_mutex_assert_locked(__unused recursive_mutex_tt<false> *lock) { } |
66799735 | 87 | static constexpr inline void |
34d5b5e8 | 88 | lockdebug_recursive_mutex_assert_unlocked(__unused recursive_mutex_tt<false> *lock) { } |