Home | History | Annotate | Download | only in lib

Lines Matching defs:lock

20  *  To avoid needing a per-object lock, this code allocates an array of
22 * For operations that must be atomic on two locations, the lower lock is
55 // Platform-specific lock implementation. Falls back to spinlocks if none is
56 // defined. Each platform should define the Lock type, and corresponding
57 // lock() and unlock() functions.
64 typedef struct _usem Lock;
65 inline static void unlock(Lock *l) {
71 inline static void lock(Lock *l) {
80 static Lock locks[SPINLOCK_COUNT] = { [0 ... SPINLOCK_COUNT-1] = {0,1,0} };
84 typedef OSSpinLock Lock;
85 inline static void unlock(Lock *l) {
88 /// Locks a lock. In the current implementation, this is potentially
90 inline static void lock(Lock *l) {
93 static Lock locks[SPINLOCK_COUNT]; // initialized to OS_SPINLOCK_INIT which is 0
96 typedef _Atomic(uintptr_t) Lock;
97 /// Unlock a lock. This is a release operation.
98 inline static void unlock(Lock *l) {
101 /// Locks a lock. In the current implementation, this is potentially
103 inline static void lock(Lock *l) {
110 static Lock locks[SPINLOCK_COUNT];
114 /// Returns a lock to use for a given pointer.
115 static inline Lock *lock_for_pointer(void *ptr) {
119 // lock.
131 /// Macros for determining whether a size is lock free. Clang can not yet
133 /// not lock free.
140 /// Macro that calls the compiler-generated lock-free versions of functions
174 Lock *l = lock_for_pointer(src);
175 lock(l);
188 Lock *l = lock_for_pointer(dest);
189 lock(l);
206 Lock *l = lock_for_pointer(ptr);
207 lock(l);
227 Lock *l = lock_for_pointer(ptr);
228 lock(l);
250 Lock *l = lock_for_pointer(src);\
251 lock(l);\
265 Lock *l = lock_for_pointer(dest);\
266 lock(l);\
278 Lock *l = lock_for_pointer(dest);\
279 lock(l);\
294 Lock *l = lock_for_pointer(ptr);\
295 lock(l);\
315 Lock *l = lock_for_pointer(ptr);\
316 lock(l);\