Changeset 90152a4 for tests/concurrent/signal/disjoint.c
- Timestamp:
- Aug 27, 2018, 4:40:34 PM (8 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
- Children:
- b7c89aa
- Parents:
- f9feab8 (diff), 305581d (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 moved
-
tests/concurrent/signal/disjoint.c (moved) (moved from src/tests/concurrent/signal/disjoint.c ) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrent/signal/disjoint.c
rf9feab8 r90152a4 1 #include <fstream> 2 #include <kernel> 3 #include <monitor> 4 #include <thread> 1 #include <fstream.hfa> 2 #include <kernel.hfa>hfa> 3 #include <monitor.hfa> 4 #include <thread.hfa> 5 #include <time.hfa> 5 6 6 #include <time.h> 7 8 static const unsigned long N = 10_000ul; 7 #include "long_tests.h" 9 8 10 9 #ifndef PREEMPTION_RATE 11 #define PREEMPTION_RATE 10 _000ul10 #define PREEMPTION_RATE 10`ms 12 11 #endif 13 12 14 unsigned intdefault_preemption() {13 Duration default_preemption() { 15 14 return PREEMPTION_RATE; 16 15 } 16 17 #ifdef TEST_LONG 18 static const unsigned long N = 300_000ul; 19 #else 20 static const unsigned long N = 10_000ul; 21 #endif 17 22 18 23 enum state_t { WAIT, SIGNAL, BARGE }; … … 23 28 monitor global_data_t; 24 29 void ?{}( global_data_t & this ); 25 void ^?{} ( global_data_t & this );30 void ^?{} ( global_data_t & mutex this ); 26 31 27 32 monitor global_data_t { … … 39 44 } 40 45 41 void ^?{} ( global_data_t & this ) {}46 void ^?{} ( global_data_t & mutex this ) {} 42 47 43 48 //------------------------------------------------------------------------------ … … 64 69 } 65 70 66 d.counter++; 71 #if !defined(TEST_FOREVER) 72 d.counter++; 73 if( (d.counter % 1000) == 0 ) sout | d.counter | endl; 74 #endif 67 75 68 if( (d.counter % 1000) == 0 ) sout | d.counter | endl; 69 70 return d.counter < N; 76 return TEST(d.counter < N); 71 77 } 72 78 … … 74 80 75 81 void main( Waiter & this ) { 76 while( wait( mut, data ) ) { yield(); }82 while( wait( mut, data ) ) { KICK_WATCHDOG; yield(); } 77 83 } 78 84 … … 91 97 92 98 //This is technically a mutual exclusion violation but the mutex monitor protects us 93 bool running = data.counter < N&& data.counter > 0;99 bool running = TEST(data.counter < N) && data.counter > 0; 94 100 if( data.state != SIGNAL && running ) { 95 101 sout | "ERROR Eager signal" | data.state | endl; … … 109 115 // Main loop 110 116 int main(int argc, char* argv[]) { 111 random_seed( time( NULL ) );117 srandom( time( NULL ) ); 112 118 all_done = false; 113 119 processor p;
Note:
See TracChangeset
for help on using the changeset viewer.