Ignore:
Timestamp:
Oct 12, 2017, 3:15:32 PM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
b6b3c42, fb31cb8
Parents:
3364962 (diff), b10c621c (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
  • src/tests/sched-ext-dtor.c

    r3364962 r0aaac0e  
    1414static const unsigned long N = 5_000ul;
    1515
    16 thread dummy_t {};
     16enum state_t {
     17        CTOR,
     18        MAIN,
     19        AFTER,
     20        END,
     21        DTOR
     22};
     23
     24thread dummy_t {
     25        state_t state;
     26};
     27
     28static inline void set_state( dummy_t & this, state_t state) {
     29        switch(state) {
     30                case CTOR  : break;
     31                case MAIN  : if( this.state != CTOR  ) { serr | "ERROR Expected state to be CTOR"  | endl; abort(); } this.state = state; break;
     32                case AFTER : if( this.state != MAIN  ) { serr | "ERROR Expected state to be MAIN"  | endl; abort(); } this.state = state; break;
     33                case END   : if( this.state != AFTER ) { serr | "ERROR Expected state to be AFTER" | endl; abort(); } this.state = state; break;
     34                case DTOR  : if( this.state != END   ) { serr | "ERROR Expected state to be END"   | endl; abort(); } this.state = state; break;
     35        }
     36}
    1737
    1838void ^?{}( dummy_t & mutex this ) {
    19         sout | "Dtor" | endl;
     39        set_state( this, DTOR );
     40}
     41
     42void ?{}( dummy_t & this ) {
     43        this.state = CTOR;
    2044}
    2145
    2246void main( dummy_t & this ) {
    2347        yield(((unsigned)rand48()) % 10);
    24         sout | "Main";
     48        set_state( this, MAIN );
    2549        waitfor( ^?{}, this ) {
    26                 sout | "After waitfor";
     50                set_state( this, AFTER );
    2751        }
    28         sout | "Ending Main";
     52        set_state( this, END );
    2953}
    3054
     
    3357        processor p;
    3458        for( int i = 0; i < N; i++ ){
    35                 dummy_t dummy;
     59                dummy_t dummy[4];
    3660                yield( ((unsigned)rand48()) % 100 );
    3761        }
Note: See TracChangeset for help on using the changeset viewer.