Ignore:
File:
1 edited

Legend:

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

    r639e4fc rf835806  
    146146
    147147        // Link lists fields
    148         // instrusive link field for threads in the ready-queue
     148        // instrusive link field for threads
    149149        struct __thread_desc_link {
    150150                struct thread$ * next;
    151151                volatile unsigned long long ts;
    152152        };
    153 
    154         // Link lists fields
    155         // instrusive link field for threads in the user_link/cltr_link
    156         struct __thread_user_link {
    157                 #ifdef __cforall
    158                         inline dlink(thread$);
    159                 #else
    160                         struct thread$ * next; struct thread$ * back;
    161                 #endif
    162         };
    163         _Static_assert(sizeof(struct __thread_user_link) == 2 * sizeof(struct thread$ *), "__thread_user_link should be consistent in C and Cforall");
    164153
    165154        struct thread$ {
     
    170159                // Link lists fields
    171160                // instrusive link field for threads
    172                 struct __thread_desc_link rdy_link;
     161                struct __thread_desc_link link;
    173162
    174163                // current execution status for coroutine
     
    206195                struct __monitor_group_t monitors;
    207196
    208                 // intrusive link fields, used for locks, monitors and any user defined data structure
    209                 // default link fields for dlist
    210                 struct __thread_user_link user_link;
    211 
    212                 // secondary intrusive link fields, used for global cluster list
    213                 // default link fields for dlist
    214                 struct __thread_user_link cltr_link;
     197                // used to put threads on dlist data structure
     198                __cfa_dlink(thread$);
     199
     200                struct {
     201                        struct thread$ * next;
     202                        struct thread$ * prev;
     203                } node;
    215204
    216205                // used to store state between clh lock/unlock
     
    225214
    226215                #if defined( __CFA_WITH_VERIFY__ )
    227                         struct processor * volatile executing;
    228216                        void * canary;
    229217                #endif
    230218        };
    231 
     219        #ifdef __cforall
     220                P9_EMBEDDED( thread$, dlink(thread$) )
     221        #endif
    232222        // Wrapper for gdb
    233223        struct cfathread_thread_t { struct thread$ debug; };
     
    241231        #ifdef __cforall
    242232        extern "Cforall" {
    243                 static inline thread$ * volatile & ?`next ( thread$ * this ) {
    244                         return this->user_link.next;
    245                 }
    246233
    247234                static inline thread$ *& get_next( thread$ & this ) __attribute__((const)) {
    248                         return this.user_link.next;
    249                 }
    250 
    251                 static inline tytagref( dlink(thread$), dlink(thread$) ) ?`inner( thread$ & this ) {
    252                         dlink(thread$) & b = this.user_link;
    253                         tytagref( dlink(thread$), dlink(thread$) ) result = { b };
    254                         return result;
    255                 }
    256 
    257                 static inline tytagref(struct __thread_user_link, dlink(thread$)) ?`inner( struct thread$ & this ) {
    258                         struct __thread_user_link & ib = this.cltr_link;
    259                         dlink(thread$) & b = ib`inner;
    260                         tytagref(struct __thread_user_link, dlink(thread$)) result = { b };
    261                         return result;
    262                 }
    263 
    264                 P9_EMBEDDED(struct __thread_user_link, dlink(thread$))
     235                        return this.link.next;
     236                }
     237
     238                static inline [thread$ *&, thread$ *& ] __get( thread$ & this ) __attribute__((const)) {
     239                        return this.node.[next, prev];
     240                }
    265241
    266242                static inline void ?{}(__monitor_group_t & this) {
Note: See TracChangeset for help on using the changeset viewer.