Ignore:
Timestamp:
Jul 12, 2021, 1:44:35 PM (3 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:
605673f, 9345684
Parents:
cf444b6 (diff), a953c2e3 (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/kernel/fwd.hfa

    rcf444b6 r6ff08d8  
    2424#endif
    2525
    26 struct $thread;
     26struct thread$;
    2727struct processor;
    2828struct cluster;
     
    3636        extern "Cforall" {
    3737                extern __attribute__((aligned(128))) thread_local struct KernelThreadData {
    38                         struct $thread          * volatile this_thread;
     38                        struct thread$          * volatile this_thread;
    3939                        struct processor        * volatile this_processor;
    4040                        volatile bool sched_lock;
     
    120120        extern "Cforall" {
    121121                extern void park( void );
    122                 extern void unpark( struct $thread * this );
    123                 static inline struct $thread * active_thread () {
    124                         struct $thread * t = publicTLS_get( this_thread );
     122                extern void unpark( struct thread$ * this );
     123                static inline struct thread$ * active_thread () {
     124                        struct thread$ * t = publicTLS_get( this_thread );
    125125                        /* paranoid */ verify( t );
    126126                        return t;
     
    144144                // Semaphore which only supports a single thread
    145145                struct single_sem {
    146                         struct $thread * volatile ptr;
     146                        struct thread$ * volatile ptr;
    147147                };
    148148
     
    156156                        bool wait(single_sem & this) {
    157157                                for() {
    158                                         struct $thread * expected = this.ptr;
     158                                        struct thread$ * expected = this.ptr;
    159159                                        if(expected == 1p) {
    160160                                                if(__atomic_compare_exchange_n(&this.ptr, &expected, 0p, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
     
    175175                        bool post(single_sem & this) {
    176176                                for() {
    177                                         struct $thread * expected = this.ptr;
     177                                        struct thread$ * expected = this.ptr;
    178178                                        if(expected == 1p) return false;
    179179                                        if(expected == 0p) {
     
    200200                        //     1p     : fulfilled (wait won't block)
    201201                        // any thread : a thread is currently waiting
    202                         struct $thread * volatile ptr;
     202                        struct thread$ * volatile ptr;
    203203                };
    204204
     
    214214                        bool wait(oneshot & this) {
    215215                                for() {
    216                                         struct $thread * expected = this.ptr;
     216                                        struct thread$ * expected = this.ptr;
    217217                                        if(expected == 1p) return false;
    218218                                        /* paranoid */ verify( expected == 0p );
     
    227227                        // Mark as fulfilled, wake thread if needed
    228228                        // return true if a thread was unparked
    229                         $thread * post(oneshot & this, bool do_unpark = true) {
    230                                 struct $thread * got = __atomic_exchange_n( &this.ptr, 1p, __ATOMIC_SEQ_CST);
     229                        thread$ * post(oneshot & this, bool do_unpark = true) {
     230                                struct thread$ * got = __atomic_exchange_n( &this.ptr, 1p, __ATOMIC_SEQ_CST);
    231231                                if( got == 0p ) return 0p;
    232232                                if(do_unpark) unpark( got );
     
    343343                        // from the server side, mark the future as fulfilled
    344344                        // delete it if needed
    345                         $thread * fulfil( future_t & this, bool do_unpark = true  ) {
     345                        thread$ * fulfil( future_t & this, bool do_unpark = true  ) {
    346346                                for() {
    347347                                        struct oneshot * expected = this.ptr;
     
    364364                                        if(__atomic_compare_exchange_n(&this.ptr, &expected, want, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
    365365                                                if( expected == 0p ) { /* paranoid */ verify( this.ptr == 1p); return 0p; }
    366                                                 $thread * ret = post( *expected, do_unpark );
     366                                                thread$ * ret = post( *expected, do_unpark );
    367367                                                __atomic_store_n( &this.ptr, 1p, __ATOMIC_SEQ_CST);
    368368                                                return ret;
Note: See TracChangeset for help on using the changeset viewer.