Ignore:
Timestamp:
Jun 15, 2021, 11:34:45 AM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
4f1b8f3f
Parents:
b6749fd (diff), 07033ce (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

    rb6749fd r6f8c46d  
    2121#include "bits/weakso_locks.hfa"
    2222#include "containers/queueLockFree.hfa"
    23 
     23#include "limits.hfa"
    2424#include "thread.hfa"
    2525
     
    8585        bool tryP(BinaryBenaphore & this) {
    8686                ssize_t c = this.counter;
     87                /* paranoid */ verify( c > MIN );
    8788                return (c >= 1) && __atomic_compare_exchange_n(&this.counter, &c, c-1, false, __ATOMIC_SEQ_CST, __ATOMIC_RELAXED);
    8889        }
     
    9293                ssize_t c = 0;
    9394                for () {
     95                        /* paranoid */ verify( this.counter < MAX );
    9496                        if (__atomic_compare_exchange_n(&this.counter, &c, c+1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
    9597                                if (c == 0) return true;
Note: See TracChangeset for help on using the changeset viewer.