Ignore:
Timestamp:
Mar 21, 2022, 12:17:27 PM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
4ecc35a
Parents:
adb3ea1 (diff), 41d3c8d (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
  • libcfa/src/concurrency/mutex_stmt.hfa

    radb3ea1 r98d1b90  
    1212};
    1313
     14
     15struct __mutex_stmt_lock_guard {
     16    void ** lockarr;
     17    __lock_size_t count;
     18};
     19
     20static inline void ?{}( __mutex_stmt_lock_guard & this, void * lockarr [], __lock_size_t count  ) {
     21    this.lockarr = lockarr;
     22    this.count = count;
     23
     24    // Sort locks based on address
     25    __libcfa_small_sort(this.lockarr, count);
     26
     27    // acquire locks in order
     28    // for ( size_t i = 0; i < count; i++ ) {
     29    //     lock(*this.lockarr[i]);
     30    // }
     31}
     32
     33static inline void ^?{}( __mutex_stmt_lock_guard & this ) with(this) {
     34    // for ( size_t i = count; i > 0; i-- ) {
     35    //     unlock(*lockarr[i - 1]);
     36    // }
     37}
     38
    1439forall(L & | is_lock(L)) {
    15 
    16     struct __mutex_stmt_lock_guard {
    17         L ** lockarr;
    18         __lock_size_t count;
    19     };
    20    
    21     static inline void ?{}( __mutex_stmt_lock_guard(L) & this, L * lockarr [], __lock_size_t count  ) {
    22         this.lockarr = lockarr;
    23         this.count = count;
    24 
    25         // Sort locks based on address
    26         __libcfa_small_sort(this.lockarr, count);
    27 
    28         // acquire locks in order
    29         for ( size_t i = 0; i < count; i++ ) {
    30             lock(*this.lockarr[i]);
    31         }
    32     }
    33    
    34     static inline void ^?{}( __mutex_stmt_lock_guard(L) & this ) with(this) {
    35         for ( size_t i = count; i > 0; i-- ) {
    36             unlock(*lockarr[i - 1]);
    37         }
    38     }
    3940
    4041    struct scoped_lock {
     
    5152    }
    5253
    53     static inline L * __get_ptr( L & this ) {
     54    static inline void * __get_mutexstmt_lock_ptr( L & this ) {
    5455        return &this;
    5556    }
    5657
    57     static inline L __get_type( L & this );
     58    static inline L __get_mutexstmt_lock_type( L & this );
    5859
    59     static inline L __get_type( L * this );
     60    static inline L __get_mutexstmt_lock_type( L * this );
    6061}
Note: See TracChangeset for help on using the changeset viewer.