Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/concurrency/actors/pingpong.cfa

    r7edf912 r77fd9fe2  
    1010
    1111struct p_msg {
    12         inline message;
    13         size_t count;
     12    inline message;
     13    size_t count;
    1414};
    15 //static inline void ?{}( p_msg & this ) { ((message &)this){}; this.count = 0; }
    16 static inline void ?{}( p_msg & this ) { this.count = 0; }
     15static inline void ?{}( p_msg & this ) { ((message &)this){}; this.count = 0; }
    1716
    1817ping * pi;
     
    2120
    2221allocation receive( ping & receiver, p_msg & msg ) {
    23         msg.count++;
    24         if ( msg.count > times ) return Finished;
     22    msg.count++;
     23    if ( msg.count > times ) return Finished;
    2524
    26         allocation retval = Nodelete;
    27         if ( msg.count == times ) retval = Finished;
    28         *po | msg;
    29         return retval;
     25    allocation retval = Nodelete;
     26    if ( msg.count == times ) retval = Finished;
     27    *po | msg;
     28    return retval;
    3029}
    3130
    3231allocation receive( pong & receiver, p_msg & msg ) {
    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;
     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;
    4039}
    4140
     
    4342
    4443int main( int argc, char * argv[] ) {
    45         sout | "start";
     44    printf("start\n");
    4645
    47         processor p[Processors - 1];
     46    processor p[Processors - 1];
    4847
    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
    5749
    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;
    5960}
Note: See TracChangeset for help on using the changeset viewer.