Changeset 77bc259 for tests/exceptions
- Timestamp:
- Feb 12, 2024, 1:07:26 PM (10 months ago)
- Branches:
- master
- Children:
- c185ca9
- Parents:
- 6b228cae
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/exceptions/pingpong_nonlocal.cfa
r6b228cae r77bc259 2 2 #include <thread.hfa> 3 3 #include <mutex_stmt.hfa> 4 #include <Exception.hfa> 4 5 5 exception num_ping_pongs { int num; }; 6 vtable(num_ping_pongs) num_ping_pongs_vt; 6 ExceptionDecl( num_ping_pongs, int num; ); 7 7 8 8 thread Ping_Pong { … … 16 16 this.name = name; 17 17 cnt = 0; 18 ?{}( except, &num_ping_pongs_vt, 0);18 ?{}( except, ExceptionArgs( num_ping_pongs, 0 ) ); 19 19 } 20 20 … … 29 29 for () { 30 30 while( ! poll( this ) ) { yield(); } 31 31 inc_resume_at( cnt ); 32 32 } 33 33 } catchResume( num_ping_pongs * e; e->num < numtimes ) { … … 37 37 mutex( sout ) sout | name | "catch" | cnt | e->num; 38 38 if ( e->num == numtimes ) { 39 39 inc_resume_at( e->num ); 40 40 } 41 41 } … … 49 49 &ping.partner = &pong; // create cycle 50 50 &pong.partner = &ping; 51 num_ping_pongs except{ &num_ping_pongs_vt, 0 }; 52 resumeAt( pong, except ); 51 resumeAt( pong, ExceptionInst( num_ping_pongs, 0 ) ); 53 52 } 54 53 sout | "main end";
Note: See TracChangeset
for help on using the changeset viewer.