Changeset 0720e049 for src/tests/sched-int-barge.c
- Timestamp:
- Aug 11, 2017, 10:33:37 AM (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:
- 54cd58b0
- Parents:
- 3d4b23fa (diff), 59a75cb (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-barge.c
r3d4b23fa r0720e049 5 5 #include <thread> 6 6 7 static const unsigned long N = 50_000ul; 8 9 #ifndef PREEMPTION_RATE 10 #define PREEMPTION_RATE 10_000ul 11 #endif 12 13 unsigned int default_preemption() { 14 return 0; 15 } 7 16 enum state_t { WAIT, SIGNAL, BARGE }; 8 17 … … 10 19 11 20 monitor global_data_t { 12 bool done;21 volatile bool done; 13 22 int counter; 14 23 state_t state; … … 51 60 c->do_wait2 = ((unsigned)rand48()) % (c->do_signal); 52 61 53 //if(c->do_wait1 == c->do_wait2) sout | "Same" | endl;62 if(c->do_wait1 == c->do_wait2) sout | "Same" | endl; 54 63 } 55 64 … … 73 82 } 74 83 75 if( c->counter >= 100_000) c->done = true;84 if( c->counter >= N ) c->done = true; 76 85 return !c->done; 77 86 } … … 89 98 } 90 99 100 static thread_desc * volatile the_threads; 101 91 102 int main(int argc, char* argv[]) { 92 rand48seed(0); 93 processor p; 94 { 95 Threads t[17]; 96 } 103 rand48seed(0); 104 processor p; 105 { 106 Threads t[17]; 107 the_threads = (thread_desc*)t; 108 } 97 109 }
Note:
See TracChangeset
for help on using the changeset viewer.