Changeset 36982fc for src/libcfa/bits
- Timestamp:
- Nov 29, 2017, 2:50:33 PM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 875a72f
- Parents:
- 8a0a64d9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/bits/locks.h
r8a0a64d9 r36982fc 65 65 66 66 // Lock the spinlock, return false if already acquired 67 static inline _Bool try_lock ( __spinlock_t & this DEBUG_CTX_PARAM2 ) {67 static inline _Bool try_lock ( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) { 68 68 _Bool result = __lock_test_and_test_and_set( this.lock ); 69 LIB_DEBUG_DO(69 __cfaabi_dbg_debug_do( 70 70 if( result ) { 71 71 this.prev_name = caller; … … 77 77 78 78 // Lock the spinlock, spin if already acquired 79 static inline void lock( __spinlock_t & this DEBUG_CTX_PARAM2 ) {79 static inline void lock( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) { 80 80 #ifndef NOEXPBACK 81 81 enum { SPIN_START = 4, SPIN_END = 64 * 1024, }; … … 98 98 #endif 99 99 } 100 LIB_DEBUG_DO(100 __cfaabi_dbg_debug_do( 101 101 this.prev_name = caller; 102 102 this.prev_thrd = this_thread; … … 105 105 106 106 // Lock the spinlock, spin if already acquired 107 static inline void lock_yield( __spinlock_t & this DEBUG_CTX_PARAM2 ) {107 static inline void lock_yield( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) { 108 108 for ( unsigned int i = 1;; i += 1 ) { 109 109 if ( __lock_test_and_test_and_set( this.lock ) ) break; 110 110 yield( i ); 111 111 } 112 LIB_DEBUG_DO(112 __cfaabi_dbg_debug_do( 113 113 this.prev_name = caller; 114 114 this.prev_thrd = this_thread;
Note: See TracChangeset
for help on using the changeset viewer.