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