Ignore:
File:
1 edited

Legend:

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

    r77fd9fe2 r7edf912  
    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; }
     15//static inline void ?{}( p_msg & this ) { ((message &)this){}; this.count = 0; }
     16static inline void ?{}( p_msg & this ) { this.count = 0; }
    1617
    1718ping * pi;
     
    2021
    2122allocation receive( ping & receiver, p_msg & msg ) {
    22     msg.count++;
    23     if ( msg.count > times ) return Finished;
     23        msg.count++;
     24        if ( msg.count > times ) return Finished;
    2425
    25     allocation retval = Nodelete;
    26     if ( msg.count == times ) retval = Finished;
    27     *po | msg;
    28     return retval;
     26        allocation retval = Nodelete;
     27        if ( msg.count == times ) retval = Finished;
     28        *po | msg;
     29        return retval;
    2930}
    3031
    3132allocation receive( pong & receiver, p_msg & msg ) {
    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;
     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;
    3940}
    4041
     
    4243
    4344int main( int argc, char * argv[] ) {
    44     printf("start\n");
     45        sout | "start";
    4546
    46     processor p[Processors - 1];
     47        processor p[Processors - 1];
    4748
    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();
    4957
    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";
    6059}
Note: See TracChangeset for help on using the changeset viewer.