Changeset a1a17a7


Ignore:
Timestamp:
May 22, 2018, 4:39:48 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, with_gc
Children:
13073be, 2c88368
Parents:
639991a
Message:

Moved thread list to cluster, all concurrency object should be accessible through gdb

Location:
src/libcfa
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/bits/containers.h

    r639991a ra1a17a7  
    224224        forall(dtype T | sized(T))
    225225        static inline void push_front( __dllist(T) & this, T & node ) with( this ) {
     226                verify(__get);
    226227                if ( head ) {
    227228                        __get( node ).next = head;
     
    246247        forall(dtype T | sized(T))
    247248        static inline void remove( __dllist(T) & this, T & node ) with( this ) {
     249                verify(__get);
    248250                if ( &node == head ) {
    249251                        if ( __get( *head ).next == head ) {
  • src/libcfa/concurrency/kernel

    r639991a ra1a17a7  
    145145        __dllist_t(struct processor) idles;
    146146
     147        // List of processors
     148        __spinlock_t thread_list_lock;
     149        __dllist_t(struct thread_desc) threads;
     150
    147151        // Link lists fields
    148152        struct {
  • src/libcfa/concurrency/kernel.c

    r639991a ra1a17a7  
    4949thread_desc * mainThread;
    5050
    51 struct { __dllist_t(thread_desc) list; __spinlock_t lock; } global_threads ;
    5251struct { __dllist_t(cluster    ) list; __spinlock_t lock; } global_clusters;
    5352
     
    118117        node.next = NULL;
    119118        node.prev = NULL;
    120         doregister(this);
     119        doregister(curr_cluster, this);
    121120
    122121        monitors{ &self_mon_p, 1, (fptr_t)0 };
     
    167166        procs{ __get };
    168167        idles{ __get };
     168        threads{ __get };
    169169
    170170        doregister(this);
     
    518518        __cfaabi_dbg_print_safe("Kernel : Starting\n");
    519519
    520         global_threads. list{ __get };
    521         global_threads. lock{};
    522520        global_clusters.list{ __get };
    523521        global_clusters.lock{};
     
    619617        ^(mainThread){};
    620618
     619        ^(global_clusters.list){};
     620        ^(global_clusters.lock){};
     621
    621622        __cfaabi_dbg_print_safe("Kernel : Shutdown complete\n");
    622623}
     
    756757//-----------------------------------------------------------------------------
    757758// Global Queues
    758 void doregister( thread_desc & thrd ) {
    759         lock      ( global_threads.lock __cfaabi_dbg_ctx2);
    760         push_front( global_threads.list, thrd );
    761         unlock    ( global_threads.lock );
    762 }
    763 
    764 void unregister( thread_desc & thrd ) {
    765         lock  ( global_threads.lock __cfaabi_dbg_ctx2);
    766         remove( global_threads.list, thrd );
    767         unlock( global_threads.lock );
    768 }
    769 
    770759void doregister( cluster     & cltr ) {
    771760        lock      ( global_clusters.lock __cfaabi_dbg_ctx2);
     
    780769}
    781770
     771void doregister( cluster * cltr, thread_desc & thrd ) {
     772        lock      (cltr->thread_list_lock __cfaabi_dbg_ctx2);
     773        push_front(cltr->threads, thrd);
     774        unlock    (cltr->thread_list_lock);
     775}
     776
     777void unregister( cluster * cltr, thread_desc & thrd ) {
     778        lock  (cltr->thread_list_lock __cfaabi_dbg_ctx2);
     779        remove(cltr->threads, thrd );
     780        unlock(cltr->thread_list_lock);
     781}
    782782
    783783void doregister( cluster * cltr, processor * proc ) {
  • src/libcfa/concurrency/kernel_private.h

    r639991a ra1a17a7  
    101101
    102102
    103 void doregister( struct thread_desc & thrd );
    104 void unregister( struct thread_desc & thrd );
     103void doregister( struct cluster & cltr );
     104void unregister( struct cluster & cltr );
    105105
    106 void doregister( struct cluster     & cltr );
    107 void unregister( struct cluster     & cltr );
     106void doregister( struct cluster * cltr, struct thread_desc & thrd );
     107void unregister( struct cluster * cltr, struct thread_desc & thrd );
    108108
    109109void doregister( struct cluster * cltr, struct processor * proc );
  • src/libcfa/concurrency/thread.c

    r639991a ra1a17a7  
    4242        node.next = NULL;
    4343        node.prev = NULL;
    44         doregister(this);
     44        doregister(curr_cluster, this);
    4545
    4646        monitors{ &self_mon_p, 1, (fptr_t)0 };
     
    4848
    4949void ^?{}(thread_desc& this) with( this ) {
    50         unregister(this);
     50        unregister(curr_cluster, this);
    5151        ^self_cor{};
    5252}
Note: See TracChangeset for help on using the changeset viewer.