Changeset eb5962a for libcfa/src/bits/locks.hfa
- Timestamp:
- Jun 21, 2022, 1:39:24 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- b62d1d6
- Parents:
- 1df492a (diff), 1dbbef6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/bits/locks.hfa
r1df492a reb5962a 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 lock30 const char * prev_name;31 // previous thread to acquire the lock32 void* prev_thrd;33 // keep track of number of times we had to spin, just in case the number is unexpectedly huge34 size_t spin_count;35 #endif36 28 }; 37 29 … … 40 32 extern void disable_interrupts() OPTIONAL_THREAD; 41 33 extern void enable_interrupts( bool poll = true ) OPTIONAL_THREAD; 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 34 #define __cfaabi_dbg_record_lock(x, y) 48 35 } 49 36 50 37 static inline void ?{}( __spinlock_t & this ) { 51 38 this.lock = 0; 52 #ifdef __CFA_DEBUG__53 this.spin_count = 0;54 #endif55 39 } 56 40 … … 77 61 for ( unsigned int i = 1;; i += 1 ) { 78 62 if ( (this.lock == 0) && (__atomic_test_and_set( &this.lock, __ATOMIC_ACQUIRE ) == 0) ) break; 79 #ifdef __CFA_DEBUG__80 this.spin_count++;81 #endif82 63 #ifndef NOEXPBACK 83 64 // exponential spin
Note: See TracChangeset
for help on using the changeset viewer.