Changes in libcfa/src/bits/locks.hfa [92e7631:2026bb6]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/bits/locks.hfa
r92e7631 r2026bb6 10 10 // Created On : Tue Oct 31 15:14:38 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 4 13:03:19 202013 // Update Count : 1 112 // Last Modified On : Sat Aug 11 15:42:24 2018 13 // Update Count : 10 14 14 // 15 15 … … 54 54 55 55 #ifdef __CFA_DEBUG__ 56 void __cfaabi_dbg_record _lock(__spinlock_t & this, const char prev_name[]);56 void __cfaabi_dbg_record(__spinlock_t & this, const char * prev_name); 57 57 #else 58 #define __cfaabi_dbg_record _lock(x, y)58 #define __cfaabi_dbg_record(x, y) 59 59 #endif 60 60 } 61 62 extern void yield( unsigned int ); 61 63 62 64 static inline void ?{}( __spinlock_t & this ) { … … 66 68 // Lock the spinlock, return false if already acquired 67 69 static inline bool try_lock ( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) { 68 disable_interrupts();69 70 bool result = (this.lock == 0) && (__atomic_test_and_set( &this.lock, __ATOMIC_ACQUIRE ) == 0); 70 71 if( result ) { 71 __cfaabi_dbg_record_lock( this, caller ); 72 } else { 73 enable_interrupts_noPoll(); 72 disable_interrupts(); 73 __cfaabi_dbg_record( this, caller ); 74 74 } 75 75 return result; … … 83 83 #endif 84 84 85 disable_interrupts();86 85 for ( unsigned int i = 1;; i += 1 ) { 87 86 if ( (this.lock == 0) && (__atomic_test_and_set( &this.lock, __ATOMIC_ACQUIRE ) == 0) ) break; … … 99 98 #endif 100 99 } 101 __cfaabi_dbg_record_lock( this, caller ); 100 disable_interrupts(); 101 __cfaabi_dbg_record( this, caller ); 102 102 } 103 103 104 104 static inline void unlock( __spinlock_t & this ) { 105 enable_interrupts_noPoll(); 105 106 __atomic_clear( &this.lock, __ATOMIC_RELEASE ); 106 enable_interrupts_noPoll();107 107 } 108 108 … … 139 139 } 140 140 141 static inline bool post(__bin_sem_t & this) with( this ) { 141 static inline void post(__bin_sem_t & this) with( this ) { 142 verify(__cfaabi_dbg_in_kernel()); 143 142 144 pthread_mutex_lock(&lock); 143 145 bool needs_signal = !signaled; … … 145 147 pthread_mutex_unlock(&lock); 146 148 147 if (needs_signal) pthread_cond_signal(&cond); 148 149 return needs_signal; 149 if (needs_signal) 150 pthread_cond_signal(&cond); 150 151 } 151 152 #endif
Note:
See TracChangeset
for help on using the changeset viewer.