Changeset 77bc259 for tests/exceptions


Ignore:
Timestamp:
Feb 12, 2024, 1:07:26 PM (5 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
c185ca9
Parents:
6b228cae
Message:

move exception macro to general location, update more code to use macros

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/exceptions/pingpong_nonlocal.cfa

    r6b228cae r77bc259  
    22#include <thread.hfa>
    33#include <mutex_stmt.hfa>
     4#include <Exception.hfa>
    45
    5 exception num_ping_pongs { int num; };
    6 vtable(num_ping_pongs) num_ping_pongs_vt;
     6ExceptionDecl( num_ping_pongs, int num; );
    77
    88thread Ping_Pong {
     
    1616        this.name = name;
    1717        cnt = 0;
    18         ?{}( except, &num_ping_pongs_vt, 0 );
     18        ?{}( except, ExceptionArgs( num_ping_pongs, 0 ) );
    1919}
    2020
     
    2929                for () {
    3030                        while( ! poll( this ) ) { yield(); }
    31             inc_resume_at( cnt );
     31                        inc_resume_at( cnt );
    3232                }
    3333        } catchResume( num_ping_pongs * e; e->num < numtimes ) {
     
    3737                mutex( sout ) sout | name | "catch" | cnt | e->num;
    3838                if ( e->num == numtimes ) {
    39             inc_resume_at( e->num );
     39                        inc_resume_at( e->num );
    4040                }
    4141        }
     
    4949                &ping.partner = &pong;                                                  // create cycle
    5050                &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 ) );
    5352        }
    5453        sout | "main end";
Note: See TracChangeset for help on using the changeset viewer.