- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrency/actors/pingpong.cfa
r77fd9fe2 r7edf912 10 10 11 11 struct p_msg { 12 13 12 inline message; 13 size_t count; 14 14 }; 15 static inline void ?{}( p_msg & this ) { ((message &)this){}; this.count = 0; } 15 //static inline void ?{}( p_msg & this ) { ((message &)this){}; this.count = 0; } 16 static inline void ?{}( p_msg & this ) { this.count = 0; } 16 17 17 18 ping * pi; … … 20 21 21 22 allocation receive( ping & receiver, p_msg & msg ) { 22 23 23 msg.count++; 24 if ( msg.count > times ) return Finished; 24 25 25 26 27 28 26 allocation retval = Nodelete; 27 if ( msg.count == times ) retval = Finished; 28 *po | msg; 29 return retval; 29 30 } 30 31 31 32 allocation receive( pong & receiver, p_msg & msg ) { 32 33 34 35 36 37 38 33 msg.count++; 34 if ( msg.count > times ) return Finished; 35 36 allocation retval = Nodelete; 37 if ( msg.count == times ) retval = Finished; 38 *pi | msg; 39 return retval; 39 40 } 40 41 … … 42 43 43 44 int main( int argc, char * argv[] ) { 44 printf("start\n");45 sout | "start"; 45 46 46 47 processor p[Processors - 1]; 47 48 48 start_actor_system( Processors ); // test passing number of processors 49 start_actor_system( Processors ); // test passing number of processors 50 ping pi_actor; 51 pong po_actor; 52 po = &po_actor; 53 pi = &pi_actor; 54 p_msg m; 55 pi_actor | m; 56 stop_actor_system(); 49 57 50 ping pi_actor; 51 pong po_actor; 52 po = &po_actor; 53 pi = &pi_actor; 54 p_msg m; 55 pi_actor | m; 56 stop_actor_system(); 57 58 printf("end\n"); 59 return 0; 58 sout | "end"; 60 59 }
Note: See TracChangeset
for help on using the changeset viewer.