Changes in libcfa/src/bits/locks.hfa [ced5e2a:418d31ac]
- File:
-
- 1 edited
-
libcfa/src/bits/locks.hfa (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/bits/locks.hfa
rced5e2a r418d31ac 26 26 // Wrap in struct to prevent false sharing with debug info 27 27 volatile bool lock; 28 #ifdef __CFA_DEBUG__ 29 // previous function to acquire the lock 30 const char * prev_name; 31 // previous thread to acquire the lock 32 void* prev_thrd; 33 // keep track of number of times we had to spin, just in case the number is unexpectedly huge 34 size_t spin_count; 35 #endif 28 36 }; 29 37 … … 32 40 extern void disable_interrupts() OPTIONAL_THREAD; 33 41 extern void enable_interrupts( bool poll = true ) OPTIONAL_THREAD; 34 #define __cfaabi_dbg_record_lock(x, y) 42 43 #ifdef __CFA_DEBUG__ 44 void __cfaabi_dbg_record_lock(__spinlock_t & this, const char prev_name[]); 45 #else 46 #define __cfaabi_dbg_record_lock(x, y) 47 #endif 35 48 } 36 49 37 50 static inline void ?{}( __spinlock_t & this ) { 38 51 this.lock = 0; 52 #ifdef __CFA_DEBUG__ 53 this.spin_count = 0; 54 #endif 39 55 } 40 56 … … 61 77 for ( unsigned int i = 1;; i += 1 ) { 62 78 if ( (this.lock == 0) && (__atomic_test_and_set( &this.lock, __ATOMIC_ACQUIRE ) == 0) ) break; 79 #ifdef __CFA_DEBUG__ 80 this.spin_count++; 81 #endif 63 82 #ifndef NOEXPBACK 64 83 // exponential spin
Note:
See TracChangeset
for help on using the changeset viewer.