Ignore:
Timestamp:
Mar 27, 2019, 11:09:23 AM (3 years ago)
Author:
tdelisle <tdelisle@…>
Branches:
arm-eh, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
a45fc7b
Parents:
2b10f95 (diff), 1e5d0f0c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/papers/concurrency/examples/Pingpong.cfa

    r2b10f95 r86fb8f2  
    44coroutine PingPong {
    55        const char * name;
    6         /* const */ unsigned int N;
    7         PingPong * part;
     6        unsigned int N;
     7        PingPong & part;
    88};
    99
    1010void ?{}( PingPong & this, const char * name, unsigned int N, PingPong & part ) {
    11         (this.__cor){name};
    12         this.name = name;
    13         this.N = N;
    14         this.part = &part;
     11        this.[name, N] = [name, N];  &this.part = &part;
    1512}
    1613void ?{}( PingPong & this, const char * name, unsigned int N ) {
    17         this{ name, N, *(PingPong *)0 };
     14        this{ name, N, *0p };                                                           // call first constructor
    1815}
    1916void cycle( PingPong & pingpong ) {
     
    2118}
    2219void partner( PingPong & this, PingPong & part ) {
    23         this.part = &part;
     20        &this.part = &part;
    2421        resume( this );
    2522}
    26 void main( PingPong & pingpong ) {                                              // ping's starter ::main, pong's starter ping
    27         for ( pingpong.N ) {                                                            // N ping-pongs
    28                 sout | pingpong.name;
    29                 cycle( *pingpong.part );
     23void main( PingPong & pingpong ) with(pingpong) {               // ping's starter ::main, pong's starter ping
     24        for ( N ) {                                                                                     // N ping-pongs
     25                sout | name;
     26                cycle( part );
    3027        } // for
    3128}
    3229int main() {
    33         enum { N = 20 };
     30        enum { N = 5 };
    3431        PingPong ping = { "ping", N }, pong = { "pong", N, ping };
    3532        partner( ping, pong );
     
    3835// Local Variables: //
    3936// tab-width: 4 //
    40 // compile-command: "cfa pingpong.cfa" //
     37// compile-command: "cfa Pingpong.cfa" //
    4138// End: //
Note: See TracChangeset for help on using the changeset viewer.