Changeset f0ce5f4


Ignore:
Timestamp:
Mar 27, 2020, 12:41:19 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
2bb2efa9, 92e7631
Parents:
ae7be7a
Message:

V-ing a semaphore now returns wether or not a thread was woken up.
Fix build compilation

Location:
libcfa/src/concurrency
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/kernel.cfa

    rae7be7a rf0ce5f4  
    312312        unregister(this->cltr, this);
    313313
    314         V( this->terminated );
     314        bool signalled = V( this->terminated );
     315        if(signalled)
    315316
    316317        __cfaabi_dbg_print_safe("Kernel : core %p terminated\n", this);
     
    920921}
    921922
    922 void V(semaphore & this) with( this ) {
     923bool V(semaphore & this) with( this ) {
    923924        $thread * thrd = 0p;
    924925        lock( lock __cfaabi_dbg_ctx2 );
     
    933934        // make new owner
    934935        unpark( thrd __cfaabi_dbg_ctx2 );
     936
     937        return thrd != 0p;
    935938}
    936939
     
    988991                void __cfaabi_dbg_record_thrd($thread & this, bool park, const char prev_name[]) {
    989992                        if(park) {
    990                                 this.prev_park    = prev_name;
    991                                 this.park_stale   = false;
     993                                this.park_caller   = prev_name;
     994                                this.park_stale    = false;
    992995                        }
    993996                        else {
    994                                 this.prev_unpark = prev_name;
    995                                 this.unpark_stale = false;
     997                                this.unpark_caller = prev_name;
     998                                this.unpark_stale  = false;
    996999                        }
    9971000                }
  • libcfa/src/concurrency/kernel.hfa

    rae7be7a rf0ce5f4  
    3838void ^?{}(semaphore & this);
    3939void   P (semaphore & this);
    40 void   V (semaphore & this);
     40bool   V (semaphore & this);
    4141
    4242
Note: See TracChangeset for help on using the changeset viewer.