- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrency/actors/inline.cfa
r7edf912 r0388a99 3 3 4 4 struct d_actor { 5 5 inline actor; 6 6 }; 7 7 struct msg_wrapper { 8 9 8 int b; 9 inline message; 10 10 }; 11 11 void ^?{}( msg_wrapper & this ) { sout | "msg_wrapper dtor"; } 12 12 13 13 struct d_msg { 14 15 14 int m; 15 inline msg_wrapper; 16 16 }; 17 17 void ?{}( d_msg & this, int m, int b ) { this.m = m; this.b = b; set_allocation( this, Delete ); } … … 19 19 20 20 allocation receive( d_actor &, d_msg & msg ) { 21 22 23 21 sout | msg.m; 22 sout | msg.b; 23 return Finished; 24 24 } 25 25 26 26 struct d_msg2 { 27 28 27 int m; 28 inline msg_wrapper; 29 29 }; 30 30 void ^?{}( d_msg2 & this ) { sout | "d_msg2 dtor";} 31 31 32 32 allocation receive( d_actor &, d_msg2 & msg ) { 33 34 33 sout | msg.m; 34 return Finished; 35 35 } 36 36 37 37 int main() { 38 39 40 start_actor_system();// sets up executor41 42 43 44 45 stop_actor_system();// waits until actors finish46 47 48 start_actor_system();// sets up executor49 50 51 52 53 54 55 56 stop_actor_system();// waits until actors finish57 38 processor p; 39 { 40 start_actor_system(); // sets up executor 41 d_actor da; 42 d_msg * dm = alloc(); 43 (*dm){ 42, 2423 }; 44 da | *dm; 45 stop_actor_system(); // waits until actors finish 46 } 47 { 48 start_actor_system(); // sets up executor 49 d_actor da; 50 d_msg2 dm{ 29079 }; 51 set_allocation( dm, Nodelete ); 52 msg_wrapper * mw = &dm; 53 message * mg = &dm; 54 virtual_dtor * v = &dm; 55 da | dm; 56 stop_actor_system(); // waits until actors finish 57 } 58 58 }
Note: See TracChangeset
for help on using the changeset viewer.