Changeset 949339b for benchmark/bench.h


Ignore:
Timestamp:
Sep 27, 2021, 2:09:55 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
Children:
cc287800
Parents:
4e28d2e9 (diff), 056cbdb (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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • benchmark/bench.h

    r4e28d2e9 r949339b  
    2121        return 1000000000LL * ts.tv_sec + ts.tv_nsec;
    2222} // bench_time
     23
     24
     25#if defined(__cforall)
     26struct test_spinlock {
     27        volatile bool lock;
     28};
     29
     30static 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
     36static inline void unlock( test_spinlock & this ) {
     37        __atomic_clear( &this.lock, __ATOMIC_RELEASE );
     38}
     39#endif
    2340
    2441#ifndef BENCH_N
Note: See TracChangeset for help on using the changeset viewer.