Changes in / [f621e43f:a41e87b]


Ignore:
Files:
4 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/locks.hfa

    rf621e43f ra41e87b  
    8282
    8383        // returns true if no blocking needed
    84         bool P(BinaryBenaphore & this) {
    85                 return __atomic_fetch_sub(&this.counter, 1, __ATOMIC_SEQ_CST) > 0;
    86         }
    87 
     84        bool P(BinaryBenaphore & this) { return __atomic_fetch_sub(&this.counter, 1, __ATOMIC_SEQ_CST) > 0; }
    8885        bool tryP(BinaryBenaphore & this) {
    8986                ssize_t c = this.counter;
     
    118115static inline void ?{}(ThreadBenaphore & this, one_t ) { (this.ben){ 1 }; }
    119116
    120 static inline bool P(ThreadBenaphore & this)              { return P(this.ben) ? false : P(this.sem); }
    121 static inline bool P(ThreadBenaphore & this, $thread * t) { return P(this.ben) ? false : P(this.sem, t ); }
     117static inline bool P(ThreadBenaphore & this)              { return /* P(this.ben) ? false : */ P(this.sem); }
     118static inline bool P(ThreadBenaphore & this, $thread * t) { return /* P(this.ben) ? false : */ P(this.sem, t ); }
    122119static inline bool tryP(ThreadBenaphore & this)           { return tryP(this.ben); }
    123120static inline bool P(ThreadBenaphore & this, bool wait)   { return wait ? P(this) : tryP(this); }
    124121
    125122static inline $thread * V(ThreadBenaphore & this, const bool doUnpark = true) {
    126         if (V(this.ben)) return 0p;
     123        // if (V(this.ben)) return 0p;
    127124        return V(this.sem, doUnpark);
    128125}
  • tests/concurrent/spinaphore.cfa

    rf621e43f ra41e87b  
    3636        this.sum = 0;
    3737        for(num_blocks) {
     38                // sout | "b P" | me;
    3839                P(sem);
    3940                if(((thread&)this).seqable.next != 0p) sout | "Link not invalidated";
     41                // sout | "a P" | me;
    4042        }
    4143}
     
    5658                this.sum += (unsigned)b;
    5759                unpark(t);
     60                // sout | "a V" | t;
    5861                yield(random(10));
    5962        }
Note: See TracChangeset for help on using the changeset viewer.