Ignore:
File:
1 edited

Legend:

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

    r8512a2f r681d8f2  
    55#include <kernel.hfa>
    66#include <iofwd.hfa>
    7 #include <virtual_dtor.hfa>
    87
    98#ifdef __CFA_DEBUG__
     
    358357    if ( seperate_clus ) delete( cluster );
    359358
    360     #ifdef STATS // print formatted stats
     359    #ifdef STATS
    361360    printf("    Actor System Stats:\n");
    362361    printf("\tActors Created:\t\t\t\t%lu\n\tMessages Sent:\t\t\t\t%lu\n", __num_actors_stats, __all_processed);
     
    389388static executor * __actor_executor_ = 0p;
    390389static bool __actor_executor_passed = false;            // was an executor passed to start_actor_system
    391 static size_t __num_actors_ = 0;                                        // number of actor objects in system
     390static size_t __num_actors_ = 0;                                // number of actor objects in system
    392391static struct thread$ * __actor_executor_thd = 0p;              // used to wake executor after actors finish
    393392struct actor {
    394     size_t ticket;                                          // executor-queue handle
     393    size_t ticket;                              // executor-queue handle
    395394    Allocation allocation_;                                         // allocation action
    396     inline virtual_dtor;
    397395};
    398396
     
    408406    #endif
    409407}
     408static inline void ^?{}( actor & this ) {}
    410409
    411410static inline void check_actor( actor & this ) {
     
    431430struct message {
    432431    Allocation allocation_;                     // allocation action
    433     inline virtual_dtor;
    434432};
    435433
    436 static inline void ?{}( message & this ) {
    437     this.allocation_ = Nodelete;
    438 }
     434static inline void ?{}( message & this ) { this.allocation_ = Nodelete; }
    439435static inline void ?{}( message & this, Allocation allocation ) {
    440436    memcpy( &this.allocation_, &allocation, sizeof(allocation) ); // optimization to elide ctor
    441437    verifyf( this.allocation_ != Finished, "The Finished Allocation status is not supported for message types.\n");
    442438}
    443 static inline void ^?{}( message & this ) with(this) {
    444     CFA_DEBUG( if ( allocation_ == Nodelete ) printf("A message at location %p was allocated but never sent.\n", &this); )
     439static inline void ^?{}( message & this ) {
     440    CFA_DEBUG( if ( this.allocation_ == Nodelete ) printf("A message at location %p was allocated but never sent.\n", &this); )
    445441}
    446442
    447443static inline void check_message( message & this ) {
    448     switch ( this.allocation_ ) {                                               // analyze message status
    449         case Nodelete: CFA_DEBUG(this.allocation_ = Finished); break;
     444    #ifdef __CFA_DEBUG__
     445    Allocation temp = this.allocation_;
     446    this.allocation_ = Finished;
     447    switch ( temp )
     448    #else
     449    switch ( this.allocation_ )
     450    #endif
     451    {                                           // analyze message status
     452        case Nodelete: break;
    450453        case Delete: delete( &this ); break;
    451454        case Destroy: ^?{}(this); break;
     
    453456    } // switch
    454457}
    455 static inline void set_allocation( message & this, Allocation state ) {
    456     this.allocation_ = state;
    457 }
     458static inline void set_allocation( message & this, Allocation state ) { this.allocation_ = state; }
    458459
    459460static inline void deliver_request( request & this ) {
     
    687688Allocation receive( actor & this, __DestroyMsg & msg ) { return Destroy; }
    688689Allocation receive( actor & this, __FinishedMsg & msg ) { return Finished; }
    689 
Note: See TracChangeset for help on using the changeset viewer.