Changes in / [7f3b5ce:f2ff0a6]


Ignore:
Location:
libcfa/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/bits/defs.hfa

    r7f3b5ce rf2ff0a6  
    3131#define __cfa_anonymous_object(x) inline struct x
    3232#define __cfa_dlink1(x) dlink(x)
    33 #define __cfa_dlink2(x, name) inline struct name { inline dlink(x); }
    3433#else
    3534#define __cfa_anonymous_object(x) struct x __cfa_anonymous_object
    3635#define __cfa_dlink1(x) struct { struct x * next; struct x * back; }
    37 #define __cfa_dlink2(x, name) struct { struct x * next; struct x * back; } __dlink ## name
    3836#endif
    3937
  • libcfa/src/concurrency/invoke.h

    r7f3b5ce rf2ff0a6  
    195195                struct __monitor_group_t monitors;
    196196
    197                 // intrusive link fields, used for locks, monitors and any user defined data structure
    198                 // default link fields for dlist
     197                // used to put threads on dlist data structure
    199198                __cfa_dlink1(thread$) user_link;
    200199
    201                 // secondary intrusive link fields, used for global cluster list
    202                 // default link fields for dlist
    203                 __cfa_dlink2(thread$, cltr_link);
     200                struct {
     201                        struct thread$ * next;
     202                        struct thread$ * prev;
     203                } node;
    204204
    205205                // used to store state between clh lock/unlock
     
    230230        #ifdef __cforall
    231231        extern "Cforall" {
    232                 static inline thread$ * volatile & ?`next ( thread$ * this ) {
    233                         return this->user_link.next;
    234                 }
    235232
    236233                static inline thread$ *& get_next( thread$ & this ) __attribute__((const)) {
    237234                        return this.user_link.next;
     235                }
     236
     237                static inline [thread$ *&, thread$ *& ] __get( thread$ & this ) __attribute__((const)) {
     238                        return this.node.[next, prev];
    238239                }
    239240
     
    243244                        return result;
    244245                }
    245 
    246                 P9_EMBEDDED(thread$, thread$.cltr_link)
    247                 P9_EMBEDDED(thread$.cltr_link, dlink(thread$))
    248246
    249247                static inline void ?{}(__monitor_group_t & this) {
  • libcfa/src/concurrency/kernel.hfa

    r7f3b5ce rf2ff0a6  
    256256        // List of threads
    257257        __spinlock_t thread_list_lock;
    258         dlist(struct thread$, thread$.cltr_link) threads;
     258        __dllist_t(struct thread$) threads;
    259259        unsigned int nthreads;
    260260
  • libcfa/src/concurrency/kernel/startup.cfa

    r7f3b5ce rf2ff0a6  
    535535        #endif
    536536
     537        node.next = 0p;
     538        node.prev = 0p;
    537539        doregister(curr_cluster, this);
    538540
     
    657659        #endif
    658660
    659         threads{};
     661        threads{ __get };
    660662
    661663        io.arbiter = create();
     
    737739        lock      (cltr->thread_list_lock __cfaabi_dbg_ctx2);
    738740        cltr->nthreads += 1;
    739         insert_first(cltr->threads, thrd);
     741        push_front(cltr->threads, thrd);
    740742        unlock    (cltr->thread_list_lock);
    741743}
     
    743745void unregister( cluster * cltr, thread$ & thrd ) {
    744746        lock  (cltr->thread_list_lock __cfaabi_dbg_ctx2);
    745         {
    746                 tytagref( dlink(thread$), dlink(thread$) ) ?`inner( thread$ & this ) = void;
    747                 with( DLINK_VIA( thread$, thread$.cltr_link ) )
    748                         remove( thrd );
    749                 cltr->nthreads -= 1;
    750         }
     747        remove(cltr->threads, thrd );
     748        cltr->nthreads -= 1;
    751749        unlock(cltr->thread_list_lock);
    752750}
  • libcfa/src/concurrency/thread.cfa

    r7f3b5ce rf2ff0a6  
    5454        #endif
    5555
     56        node.next = 0p;
     57        node.prev = 0p;
     58
    5659        clh_node = malloc( );
    5760        *clh_node = false;
Note: See TracChangeset for help on using the changeset viewer.