Ignore:
Timestamp:
Jul 5, 2021, 4:44:20 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
7f62b708
Parents:
ee23a8d
Message:

Step 1 of changing $thread to thread$

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/invoke.h

    ree23a8d re84ab3d  
    7171        enum __Coroutine_State { Halted, Start, Primed, Blocked, Ready, Active, Cancelled, Halting };
    7272
    73         struct $coroutine {
     73        struct coroutine$ {
    7474                // context that is switch during a __cfactx_switch
    7575                struct __stack_context_t context;
     
    8585
    8686                // first coroutine to resume this one
    87                 struct $coroutine * starter;
     87                struct coroutine$ * starter;
    8888
    8989                // last coroutine to resume this one
    90                 struct $coroutine * last;
     90                struct coroutine$ * last;
    9191
    9292                // If non-null stack must be unwound with this exception
     
    9595        };
    9696        // Wrapper for gdb
    97         struct cfathread_coroutine_t { struct $coroutine debug; };
    98 
    99         static inline struct __stack_t * __get_stack( struct $coroutine * cor ) {
     97        struct cfathread_coroutine_t { struct coroutine$ debug; };
     98
     99        static inline struct __stack_t * __get_stack( struct coroutine$ * cor ) {
    100100                return (struct __stack_t*)(((uintptr_t)cor->stack.storage) & ((uintptr_t)-2));
    101101        }
     
    110110        };
    111111
    112         struct $monitor {
     112        struct monitor$ {
    113113                // spinlock to protect internal data
    114114                struct __spinlock_t lock;
    115115
    116116                // current owner of the monitor
    117                 struct $thread * owner;
     117                struct thread$ * owner;
    118118
    119119                // queue of threads that are blocked waiting for the monitor
    120                 __queue_t(struct $thread) entry_queue;
     120                __queue_t(struct thread$) entry_queue;
    121121
    122122                // stack of conditions to run next once we exit the monitor
     
    133133        };
    134134        // Wrapper for gdb
    135         struct cfathread_monitor_t { struct $monitor debug; };
     135        struct cfathread_monitor_t { struct monitor$ debug; };
    136136
    137137        struct __monitor_group_t {
    138138                // currently held monitors
    139                 __cfa_anonymous_object( __small_array_t($monitor*) );
     139                __cfa_anonymous_object( __small_array_t(monitor$*) );
    140140
    141141                // last function that acquired monitors
     
    146146        // instrusive link field for threads
    147147        struct __thread_desc_link {
    148                 struct $thread * next;
     148                struct thread$ * next;
    149149                volatile unsigned long long ts;
    150150        };
    151151
    152         struct $thread {
     152        struct thread$ {
    153153                // Core threading fields
    154154                // context that is switch during a __cfactx_switch
     
    179179
    180180                // coroutine body used to store context
    181                 struct $coroutine  self_cor;
     181                struct coroutine$  self_cor;
    182182
    183183                // current active context
    184                 struct $coroutine * curr_cor;
     184                struct coroutine$ * curr_cor;
    185185
    186186                // monitor body used for mutual exclusion
    187                 struct $monitor    self_mon;
     187                struct monitor$    self_mon;
    188188
    189189                // pointer to monitor with sufficient lifetime for current monitors
    190                 struct $monitor *  self_mon_p;
     190                struct monitor$ *  self_mon_p;
    191191
    192192                // monitors currently held by this thread
     
    195195                // used to put threads on user data structures
    196196                struct {
    197                         struct $thread * next;
    198                         struct $thread * back;
     197                        struct thread$ * next;
     198                        struct thread$ * back;
    199199                } seqable;
    200200
    201201                // used to put threads on dlist data structure
    202                 __cfa_dlink($thread);
     202                __cfa_dlink(thread$);
    203203
    204204                struct {
    205                         struct $thread * next;
    206                         struct $thread * prev;
     205                        struct thread$ * next;
     206                        struct thread$ * prev;
    207207                } node;
    208208
     
    214214        };
    215215        #ifdef __cforall
    216                 P9_EMBEDDED( $thread, dlink($thread) )
     216                P9_EMBEDDED( thread$, dlink(thread$) )
    217217        #endif
    218218        // Wrapper for gdb
    219         struct cfathread_thread_t { struct $thread debug; };
     219        struct cfathread_thread_t { struct thread$ debug; };
    220220
    221221        #ifdef __CFA_DEBUG__
    222                 void __cfaabi_dbg_record_thrd($thread & this, bool park, const char prev_name[]);
     222                void __cfaabi_dbg_record_thrd(thread$ & this, bool park, const char prev_name[]);
    223223        #else
    224224                #define __cfaabi_dbg_record_thrd(x, y, z)
     
    228228        extern "Cforall" {
    229229
    230                 static inline $thread *& get_next( $thread & this ) __attribute__((const)) {
     230                static inline thread$ *& get_next( thread$ & this ) __attribute__((const)) {
    231231                        return this.link.next;
    232232                }
    233233
    234                 static inline [$thread *&, $thread *& ] __get( $thread & this ) __attribute__((const)) {
     234                static inline [thread$ *&, thread$ *& ] __get( thread$ & this ) __attribute__((const)) {
    235235                        return this.node.[next, prev];
    236236                }
    237237
    238                 static inline $thread * volatile & ?`next ( $thread * this )  __attribute__((const)) {
     238                static inline thread$ * volatile & ?`next ( thread$ * this )  __attribute__((const)) {
    239239                        return this->seqable.next;
    240240                }
    241241
    242                 static inline $thread *& Back( $thread * this ) __attribute__((const)) {
     242                static inline thread$ *& Back( thread$ * this ) __attribute__((const)) {
    243243                        return this->seqable.back;
    244244                }
    245245
    246                 static inline $thread *& Next( $thread * this ) __attribute__((const)) {
     246                static inline thread$ *& Next( thread$ * this ) __attribute__((const)) {
    247247                                return this->seqable.next;
    248248                }
    249249
    250                 static inline bool listed( $thread * this ) {
     250                static inline bool listed( thread$ * this ) {
    251251                        return this->seqable.next != 0p;
    252252                }
     
    258258                }
    259259
    260                 static inline void ?{}(__monitor_group_t & this, struct $monitor ** data, __lock_size_t size, fptr_t func) {
     260                static inline void ?{}(__monitor_group_t & this, struct monitor$ ** data, __lock_size_t size, fptr_t func) {
    261261                        (this.data){data};
    262262                        (this.size){size};
Note: See TracChangeset for help on using the changeset viewer.