Ignore:
Timestamp:
Jun 29, 2021, 5:35:19 PM (2 years ago)
Author:
caparsons <caparson@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
dcad80a
Parents:
5a46e09 (diff), d02e547 (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/locks.hfa

    r5a46e09 r660665f  
    2424#include "containers/list.hfa"
    2525
     26#include "limits.hfa"
    2627#include "thread.hfa"
    2728
     
    8788        bool tryP(BinaryBenaphore & this) {
    8889                ssize_t c = this.counter;
     90                /* paranoid */ verify( c > MIN );
    8991                return (c >= 1) && __atomic_compare_exchange_n(&this.counter, &c, c-1, false, __ATOMIC_SEQ_CST, __ATOMIC_RELAXED);
    9092        }
     
    9496                ssize_t c = 0;
    9597                for () {
     98                        /* paranoid */ verify( this.counter < MAX );
    9699                        if (__atomic_compare_exchange_n(&this.counter, &c, c+1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
    97100                                if (c == 0) return true;
     
    173176        ThreadBenaphore sem;
    174177};
     178
     179static inline void ?{}(fast_lock & this) { this.owner = 0p; }
    175180
    176181static inline bool $try_lock(fast_lock & this, $thread * thrd) {
Note: See TracChangeset for help on using the changeset viewer.