Changeset d4e68a6 for libcfa/src


Ignore:
Timestamp:
Jun 23, 2019, 3:55:32 PM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
9504a89
Parents:
dc33b5b
Message:

move location of active_xxx routines, and counter for number processors on a cluster

Location:
libcfa/src/concurrency
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/coroutine.hfa

    rdc33b5b rd4e68a6  
    1010// Created On       : Mon Nov 28 12:27:26 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 30 18:23:45 2018
    13 // Update Count     : 8
     12// Last Modified On : Fri Jun 21 17:49:39 2019
     13// Update Count     : 9
    1414//
    1515
     
    5353forall(dtype T | is_coroutine(T))
    5454void prime(T & cor);
     55
     56static inline struct coroutine_desc * active_coroutine() { return TL_GET( this_thread )->curr_cor; }
    5557
    5658//-----------------------------------------------------------------------------
  • libcfa/src/concurrency/invoke.h

    rdc33b5b rd4e68a6  
    1010// Created On       : Tue Jan 17 12:27:26 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat May 19 08:23:21 2018
    13 // Update Count     : 31
     12// Last Modified On : Sat Jun 22 18:19:13 2019
     13// Update Count     : 40
    1414//
    1515
     
    4646        #ifdef __cforall
    4747        extern "Cforall" {
    48                 static inline struct thread_desc             * & get_next( struct thread_desc             & this );
    49                 static inline struct __condition_criterion_t * & get_next( struct __condition_criterion_t & this );
     48                static inline struct thread_desc             *& get_next( struct thread_desc             & this );
     49                static inline struct __condition_criterion_t *& get_next( struct __condition_criterion_t & this );
    5050
    5151                extern thread_local struct KernelThreadData {
     
    199199        #ifdef __cforall
    200200        extern "Cforall" {
    201                 static inline struct coroutine_desc * active_coroutine() { return TL_GET( this_thread )->curr_cor; }
    202                 static inline struct thread_desc    * active_thread   () { return TL_GET( this_thread    ); }
    203                 static inline struct processor      * active_processor() { return TL_GET( this_processor ); } // UNSAFE
    204 
    205                 static inline thread_desc * & get_next( thread_desc & this ) {
     201                static inline thread_desc *& get_next( thread_desc & this ) {
    206202                        return this.next;
    207203                }
     
    210206                        return this.node.[next, prev];
    211207                }
    212 
    213                 static inline struct __condition_criterion_t * & get_next( struct __condition_criterion_t & this );
    214208
    215209                static inline void ?{}(__monitor_group_t & this) {
  • libcfa/src/concurrency/kernel.cfa

    rdc33b5b rd4e68a6  
    1010// Created On       : Tue Jan 17 12:27:26 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Apr  9 16:11:46 2018
    13 // Update Count     : 24
     12// Last Modified On : Thu Jun 20 17:21:23 2019
     13// Update Count     : 25
    1414//
    1515
     
    907907void doregister( cluster * cltr, thread_desc & thrd ) {
    908908        lock      (cltr->thread_list_lock __cfaabi_dbg_ctx2);
     909        cltr->nthreads += 1;
    909910        push_front(cltr->threads, thrd);
    910911        unlock    (cltr->thread_list_lock);
     
    914915        lock  (cltr->thread_list_lock __cfaabi_dbg_ctx2);
    915916        remove(cltr->threads, thrd );
     917        cltr->nthreads -= 1;
    916918        unlock(cltr->thread_list_lock);
    917919}
     
    919921void doregister( cluster * cltr, processor * proc ) {
    920922        lock      (cltr->proc_list_lock __cfaabi_dbg_ctx2);
     923        cltr->nprocessors += 1;
    921924        push_front(cltr->procs, *proc);
    922925        unlock    (cltr->proc_list_lock);
     
    926929        lock  (cltr->proc_list_lock __cfaabi_dbg_ctx2);
    927930        remove(cltr->procs, *proc );
     931        cltr->nprocessors -= 1;
    928932        unlock(cltr->proc_list_lock);
    929933}
  • libcfa/src/concurrency/kernel.hfa

    rdc33b5b rd4e68a6  
    1010// Created On       : Tue Jan 17 12:27:26 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Apr 10 14:46:49 2018
    13 // Update Count     : 10
     12// Last Modified On : Sat Jun 22 11:39:17 2019
     13// Update Count     : 16
    1414//
    1515
     
    9191        this.lock = NULL;
    9292}
    93 static inline void ^?{}(FinishAction & this) {}
     93static inline void ^?{}(FinishAction &) {}
    9494
    9595// Processor
     
    176176        __dllist_t(struct processor) procs;
    177177        __dllist_t(struct processor) idles;
    178 
    179         // List of processors
     178        unsigned int nprocessors;
     179
     180        // List of threads
    180181        __spinlock_t thread_list_lock;
    181182        __dllist_t(struct thread_desc) threads;
     183        unsigned int nthreads;
    182184
    183185        // Link lists fields
     
    200202}
    201203
     204static inline struct processor * active_processor() { return TL_GET( this_processor ); } // UNSAFE
     205static inline struct cluster   * active_cluster  () { return TL_GET( this_processor )->cltr; }
     206
    202207// Local Variables: //
    203208// mode: c //
  • libcfa/src/concurrency/thread.hfa

    rdc33b5b rd4e68a6  
    1010// Created On       : Tue Jan 17 12:27:26 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 29 14:07:11 2018
    13 // Update Count     : 4
     12// Last Modified On : Fri Jun 21 17:51:33 2019
     13// Update Count     : 5
    1414//
    1515
     
    9191void yield( unsigned times );
    9292
     93static inline struct thread_desc * active_thread () { return TL_GET( this_thread ); }
     94
    9395// Local Variables: //
    9496// mode: c //
Note: See TracChangeset for help on using the changeset viewer.