Changeset 0aaac0e for src/tests/sched-ext-dtor.c
- Timestamp:
- Oct 12, 2017, 3:15:32 PM (8 years ago)
- 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. - File:
-
- 1 edited
-
src/tests/sched-ext-dtor.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/tests/sched-ext-dtor.c
r3364962 r0aaac0e 14 14 static const unsigned long N = 5_000ul; 15 15 16 thread dummy_t {}; 16 enum state_t { 17 CTOR, 18 MAIN, 19 AFTER, 20 END, 21 DTOR 22 }; 23 24 thread dummy_t { 25 state_t state; 26 }; 27 28 static 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 } 17 37 18 38 void ^?{}( dummy_t & mutex this ) { 19 sout | "Dtor" | endl; 39 set_state( this, DTOR ); 40 } 41 42 void ?{}( dummy_t & this ) { 43 this.state = CTOR; 20 44 } 21 45 22 46 void main( dummy_t & this ) { 23 47 yield(((unsigned)rand48()) % 10); 24 s out | "Main";48 set_state( this, MAIN ); 25 49 waitfor( ^?{}, this ) { 26 s out | "After waitfor";50 set_state( this, AFTER ); 27 51 } 28 s out | "Ending Main";52 set_state( this, END ); 29 53 } 30 54 … … 33 57 processor p; 34 58 for( int i = 0; i < N; i++ ){ 35 dummy_t dummy ;59 dummy_t dummy[4]; 36 60 yield( ((unsigned)rand48()) % 100 ); 37 61 }
Note:
See TracChangeset
for help on using the changeset viewer.