#include #include #include #include #include int Times = 1000000; // default values struct derived_actor { inline actor; }; struct derived_msg { inline message; int cnt; }; void ?{}( derived_msg & this, int cnt ) { set_allocation( this, Nodelete ); this.cnt = cnt; } void ?{}( derived_msg & this ) { ((derived_msg &)this){ 0 }; } allocation receive( derived_actor & receiver, derived_msg & msg ) { if ( msg.cnt >= Times ) { sout | "Done"; return Finished; } msg.cnt++; receiver | msg; return Nodelete; } int main( int argc, char * argv[] ) { switch ( argc ) { case 2: if ( strcmp( argv[1], "d" ) != 0 ) { // default ? Times = ato( argv[1] ); if ( Times < 1 ) fallthru default; } // if case 1: // use defaults break; default: exit | "Usage: " | argv[0] | " [ times (> 0) ]"; } // switch sout | "starting"; executor e{ 0, 1, 1, false }; actor_start( e ); sout | "started"; derived_msg msg; derived_actor actor; actor | msg; actor_stop(); sout | "stopped"; }