Changeset 3f7e12cb for src/tests/sched-int-block.c
- Timestamp:
- Nov 8, 2017, 5:43:33 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:
- 954908d
- Parents:
- 78315272 (diff), e35f30a (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
Legend:
- Unmodified
- Added
- Removed
-
src/tests/sched-int-block.c
r78315272 r3f7e12cb 1 //--------------------------------------------------------- 2 // Barging test 3 // Ensures that no barging can occur between : 4 // - the frontend of the signal_block and the signaled thread 5 // - the signaled threadand the backend of the signal_block 6 //--------------------------------------------------------- 7 8 1 9 #include <fstream> 2 10 #include <kernel> … … 39 47 //------------------------------------------------------------------------------ 40 48 void wait_op( global_data_t & mutex a, global_data_t & mutex b, unsigned i ) { 41 wait( &cond, (uintptr_t)this_thread );49 wait( cond, (uintptr_t)this_thread ); 42 50 43 yield( ((unsigned)rand48()) % 10);51 yield( random( 10 ) ); 44 52 45 53 if(a.last_thread != a.last_signaller || b.last_thread != b.last_signaller ) { … … 50 58 a.last_thread = b.last_thread = this_thread; 51 59 52 yield( ((unsigned)rand48()) % 10);60 yield( random( 10 ) ); 53 61 } 54 62 … … 62 70 //------------------------------------------------------------------------------ 63 71 void signal_op( global_data_t & mutex a, global_data_t & mutex b ) { 64 yield( ((unsigned)rand48()) % 10);72 yield( random( 10 ) ); 65 73 66 74 [a.last_thread, b.last_thread, a.last_signaller, b.last_signaller] = this_thread; 67 75 68 if( !is_empty( &cond ) ) {76 if( !is_empty( cond ) ) { 69 77 70 thread_desc * next = front( &cond );78 thread_desc * next = front( cond ); 71 79 72 if( ! signal_block( &cond ) ) {80 if( ! signal_block( cond ) ) { 73 81 sout | "ERROR expected to be able to signal" | endl; 74 82 abort(); 75 83 } 76 84 77 yield( ((unsigned)rand48()) % 10);85 yield( random( 10 ) ); 78 86 79 87 if(a.last_thread != next || b.last_thread != next) { … … 110 118 111 119 int main(int argc, char* argv[]) { 112 rand 48seed( time( NULL ) );120 random_seed( time( NULL ) ); 113 121 done = false; 114 122 processor p;
Note:
See TracChangeset
for help on using the changeset viewer.