- File:
-
- 1 edited
-
libcfa/src/concurrency/actor.hfa (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/actor.hfa
r8512a2f r681d8f2 5 5 #include <kernel.hfa> 6 6 #include <iofwd.hfa> 7 #include <virtual_dtor.hfa>8 7 9 8 #ifdef __CFA_DEBUG__ … … 358 357 if ( seperate_clus ) delete( cluster ); 359 358 360 #ifdef STATS // print formatted stats359 #ifdef STATS 361 360 printf(" Actor System Stats:\n"); 362 361 printf("\tActors Created:\t\t\t\t%lu\n\tMessages Sent:\t\t\t\t%lu\n", __num_actors_stats, __all_processed); … … 389 388 static executor * __actor_executor_ = 0p; 390 389 static 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 system390 static size_t __num_actors_ = 0; // number of actor objects in system 392 391 static struct thread$ * __actor_executor_thd = 0p; // used to wake executor after actors finish 393 392 struct actor { 394 size_t ticket; // executor-queue handle393 size_t ticket; // executor-queue handle 395 394 Allocation allocation_; // allocation action 396 inline virtual_dtor;397 395 }; 398 396 … … 408 406 #endif 409 407 } 408 static inline void ^?{}( actor & this ) {} 410 409 411 410 static inline void check_actor( actor & this ) { … … 431 430 struct message { 432 431 Allocation allocation_; // allocation action 433 inline virtual_dtor;434 432 }; 435 433 436 static inline void ?{}( message & this ) { 437 this.allocation_ = Nodelete; 438 } 434 static inline void ?{}( message & this ) { this.allocation_ = Nodelete; } 439 435 static inline void ?{}( message & this, Allocation allocation ) { 440 436 memcpy( &this.allocation_, &allocation, sizeof(allocation) ); // optimization to elide ctor 441 437 verifyf( this.allocation_ != Finished, "The Finished Allocation status is not supported for message types.\n"); 442 438 } 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); )439 static inline void ^?{}( message & this ) { 440 CFA_DEBUG( if ( this.allocation_ == Nodelete ) printf("A message at location %p was allocated but never sent.\n", &this); ) 445 441 } 446 442 447 443 static 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; 450 453 case Delete: delete( &this ); break; 451 454 case Destroy: ^?{}(this); break; … … 453 456 } // switch 454 457 } 455 static inline void set_allocation( message & this, Allocation state ) { 456 this.allocation_ = state; 457 } 458 static inline void set_allocation( message & this, Allocation state ) { this.allocation_ = state; } 458 459 459 460 static inline void deliver_request( request & this ) { … … 687 688 Allocation receive( actor & this, __DestroyMsg & msg ) { return Destroy; } 688 689 Allocation receive( actor & this, __FinishedMsg & msg ) { return Finished; } 689
Note:
See TracChangeset
for help on using the changeset viewer.