Changes in benchmark/bench.h [846c026:ce9f9d4]
- File:
-
- 1 edited
-
benchmark/bench.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
benchmark/bench.h
r846c026 rce9f9d4 21 21 return 1000000000LL * ts.tv_sec + ts.tv_nsec; 22 22 } // bench_time 23 24 25 #if defined(__cforall) 26 struct test_spinlock { 27 volatile bool lock; 28 }; 29 30 static inline void lock( test_spinlock & this ) { 31 for ( ;; ) { 32 if ( (this.lock == 0) && (__atomic_test_and_set( &this.lock, __ATOMIC_ACQUIRE ) == 0) ) break; 33 } 34 } 35 36 static inline void unlock( test_spinlock & this ) { 37 __atomic_clear( &this.lock, __ATOMIC_RELEASE ); 38 } 39 #endif 23 40 24 41 #ifndef BENCH_N
Note:
See TracChangeset
for help on using the changeset viewer.