Changes in src/libcfa/bits/locks.h [0cf5b79:875a72f]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/bits/locks.h
r0cf5b79 r875a72f 16 16 #pragma once 17 17 18 #include "bits/debug.h" 18 19 #include "bits/defs.h" 19 20 … … 65 66 66 67 // Lock the spinlock, return false if already acquired 67 static inline _Bool try_lock ( __spinlock_t & this DEBUG_CTX_PARAM2 ) {68 static inline _Bool try_lock ( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) { 68 69 _Bool result = __lock_test_and_test_and_set( this.lock ); 69 LIB_DEBUG_DO(70 __cfaabi_dbg_debug_do( 70 71 if( result ) { 71 72 this.prev_name = caller; … … 77 78 78 79 // Lock the spinlock, spin if already acquired 79 static inline void lock( __spinlock_t & this DEBUG_CTX_PARAM2 ) {80 static inline void lock( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) { 80 81 #ifndef NOEXPBACK 81 82 enum { SPIN_START = 4, SPIN_END = 64 * 1024, }; … … 98 99 #endif 99 100 } 100 LIB_DEBUG_DO(101 __cfaabi_dbg_debug_do( 101 102 this.prev_name = caller; 102 103 this.prev_thrd = this_thread; … … 105 106 106 107 // Lock the spinlock, spin if already acquired 107 static inline void lock_yield( __spinlock_t & this DEBUG_CTX_PARAM2 ) {108 static inline void lock_yield( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) { 108 109 for ( unsigned int i = 1;; i += 1 ) { 109 110 if ( __lock_test_and_test_and_set( this.lock ) ) break; 110 111 yield( i ); 111 112 } 112 LIB_DEBUG_DO(113 __cfaabi_dbg_debug_do( 113 114 this.prev_name = caller; 114 115 this.prev_thrd = this_thread;
Note: See TracChangeset
for help on using the changeset viewer.