Changeset 105fb21


Ignore:
Timestamp:
Nov 11, 2024, 10:29:15 PM (10 days ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
41882628
Parents:
7e943e1
Message:

rename start_actor_system and stop_actor_system, add implicit messages start_msg and stop_msg

File:
1 edited

Legend:

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

    r7e943e1 r105fb21  
    398398// TODO: update globals in this file to be static fields once the static fields project is done
    399399static executor * __actor_executor_ = 0p;
    400 static bool __actor_executor_passed = false;                    // was an executor passed to start_actor_system
     400static bool __actor_executor_passed = false;                    // was an executor passed to actor_start
    401401static size_t __num_actors_ = 0;                                                // number of actor objects in system
    402402static struct thread$ * __actor_executor_thd = 0p;              // used to wake executor after actors finish
     
    410410        // Once an actor is allocated it must be sent a message or the actor system cannot stop. Hence, its receive
    411411        // member must be called to end it
    412         DEBUG_ABORT( __actor_executor_ == 0p, "Creating actor before calling start_actor_system() can cause undefined behaviour.\n" );
     412        DEBUG_ABORT( __actor_executor_ == 0p, "Creating actor before calling actor_start() can cause undefined behaviour.\n" );
    413413        alloc = Nodelete;
    414414        ticket = __get_next_ticket( *__actor_executor_ );
     
    682682}
    683683
    684 static inline void start_actor_system( size_t num_thds ) {
     684static inline void actor_start( size_t num_thds ) {
    685685        __reset_stats();
    686686        __actor_executor_thd = active_thread();
     
    689689}
    690690
    691 static inline void start_actor_system() { start_actor_system( get_proc_count( *active_cluster() ) ); }
    692 
    693 static inline void start_actor_system( executor & this ) {
     691static inline void actor_start() { actor_start( get_proc_count( *active_cluster() ) ); }
     692
     693static inline void actor_start( executor & this ) {
    694694        __reset_stats();
    695695        __actor_executor_thd = active_thread();
     
    698698}
    699699
    700 static inline void stop_actor_system() {
     700static inline void actor_stop() {
    701701        park();                                                                                         // unparked when actor system is finished
    702702
     
    715715struct finished_msg_t { inline message; } finished_msg = __base_msg_finished;
    716716
    717 allocation receive( actor & this, delete_msg_t & msg ) { return Delete; }
    718 allocation receive( actor & this, destroy_msg_t & msg ) { return Destroy; }
    719 allocation receive( actor & this, finished_msg_t & msg ) { return Finished; }
     717allocation receive( actor & this, delete_msg_t & ) { return Delete; }
     718allocation receive( actor & this, destroy_msg_t & ) { return Destroy; }
     719allocation receive( actor & this, finished_msg_t & ) { return Finished; }
    720720
    721721// Default messages used all the time.
    722 //static struct startmsg_t { inline message; } start_msg; // start actor
    723 //static struct stopmsg_t { inline message; } stop_msg; // terminate actor
     722struct start_msg_t { inline message; } start_msg = __base_msg_finished; // start actor
     723struct stop_msg_t { inline message; } stop_msg = __base_msg_finished; // terminate actor
Note: See TracChangeset for help on using the changeset viewer.