Ignore:
Timestamp:
May 22, 2018, 4:46:29 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
59c034c6, d807ca28
Parents:
a8706fc (diff), a1a17a7 (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:/u/cforall/software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/kernel.c

    ra8706fc r2c88368  
    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
    5453//-----------------------------------------------------------------------------
    5554// Global state
    56 
    57 // volatile thread_local bool preemption_in_progress = 0;
    58 // volatile thread_local bool preemption_enabled = false;
    59 // volatile thread_local unsigned short disable_preempt_count = 1;
    60 
    6155thread_local struct KernelThreadData kernelTLS = {
    6256        NULL,
     
    123117        node.next = NULL;
    124118        node.prev = NULL;
    125         doregister(this);
     119        doregister(curr_cluster, this);
    126120
    127121        monitors{ &self_mon_p, 1, (fptr_t)0 };
     
    172166        procs{ __get };
    173167        idles{ __get };
     168        threads{ __get };
    174169
    175170        doregister(this);
     
    523518        __cfaabi_dbg_print_safe("Kernel : Starting\n");
    524519
    525         global_threads. list{ __get };
    526         global_threads. lock{};
    527520        global_clusters.list{ __get };
    528521        global_clusters.lock{};
     
    624617        ^(mainThread){};
    625618
     619        ^(global_clusters.list){};
     620        ^(global_clusters.lock){};
     621
    626622        __cfaabi_dbg_print_safe("Kernel : Shutdown complete\n");
    627623}
     
    697693        else {
    698694                int len = snprintf( abort_text, abort_text_size, "Error occurred outside of any thread.\n" );
     695                __cfaabi_dbg_bits_write( abort_text, len );
    699696        }
    700697}
     
    760757//-----------------------------------------------------------------------------
    761758// Global Queues
    762 void doregister( thread_desc & thrd ) {
    763         // lock      ( global_thread.lock );
    764         // push_front( global_thread.list, thrd );
    765         // unlock    ( global_thread.lock );
    766 }
    767 
    768 void unregister( thread_desc & thrd ) {
    769         // lock  ( global_thread.lock );
    770         // remove( global_thread.list, thrd );
    771         // unlock( global_thread.lock );
    772 }
    773 
    774759void doregister( cluster     & cltr ) {
    775         // lock      ( global_cluster.lock );
    776         // push_front( global_cluster.list, cltr );
    777         // unlock    ( global_cluster.lock );
     760        lock      ( global_clusters.lock __cfaabi_dbg_ctx2);
     761        push_front( global_clusters.list, cltr );
     762        unlock    ( global_clusters.lock );
    778763}
    779764
    780765void unregister( cluster     & cltr ) {
    781         // lock  ( global_cluster.lock );
    782         // remove( global_cluster.list, cltr );
    783         // unlock( global_cluster.lock );
    784 }
    785 
     766        lock  ( global_clusters.lock __cfaabi_dbg_ctx2);
     767        remove( global_clusters.list, cltr );
     768        unlock( global_clusters.lock );
     769}
     770
     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}
    786782
    787783void doregister( cluster * cltr, processor * proc ) {
    788         // lock      (cltr->proc_list_lock __cfaabi_dbg_ctx2);
    789         // push_front(cltr->procs, *proc);
    790         // unlock    (cltr->proc_list_lock);
     784        lock      (cltr->proc_list_lock __cfaabi_dbg_ctx2);
     785        push_front(cltr->procs, *proc);
     786        unlock    (cltr->proc_list_lock);
    791787}
    792788
    793789void unregister( cluster * cltr, processor * proc ) {
    794         // lock  (cltr->proc_list_lock __cfaabi_dbg_ctx2);
    795         // remove(cltr->procs, *proc );
    796         // unlock(cltr->proc_list_lock);
     790        lock  (cltr->proc_list_lock __cfaabi_dbg_ctx2);
     791        remove(cltr->procs, *proc );
     792        unlock(cltr->proc_list_lock);
    797793}
    798794
Note: See TracChangeset for help on using the changeset viewer.