Changeset 7bdcac1 for src/tests/concurrent
- Timestamp:
- Jun 11, 2018, 10:16:04 AM (6 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, with_gc
- Children:
- 3fc59bdb
- Parents:
- 85b1deb
- Location:
- src/tests/concurrent
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/concurrent/coroutineYield.c
r85b1deb r7bdcac1 4 4 #include <thread> 5 5 #include <time> 6 7 #include "long_tests.h" 6 8 7 9 #ifndef PREEMPTION_RATE … … 13 15 } 14 16 15 #ifdef LONG_TEST17 #ifdef TEST_LONG 16 18 static const unsigned long N = 600_000ul; 17 19 #else … … 33 35 int main(int argc, char* argv[]) { 34 36 Coroutine c; 35 for(int i = 0; i < N; i++) {37 for(int i = 0; TEST(i < N); i++) { 36 38 sout | "Thread 1" | endl; 37 39 resume(c); 38 40 sout | "Thread 2" | endl; 39 41 yield(); 42 KICK_WATCHDOG; 40 43 } 41 44 } -
src/tests/concurrent/preempt.c
r85b1deb r7bdcac1 2 2 #include <thread> 3 3 #include <time> 4 5 #include "long_tests.h" 4 6 5 7 #ifndef PREEMPTION_RATE … … 11 13 } 12 14 13 #ifdef LONG_TEST15 #ifdef TEST_LONG 14 16 static const unsigned long N = 30_000ul; 15 17 #else … … 30 32 31 33 void main(worker_t & this) { 32 while( counter < N) {34 while(TEST(counter < N)) { 33 35 __cfaabi_check_preemption(); 34 36 if( (counter % 7) == this.value ) { … … 40 42 } 41 43 __cfaabi_check_preemption(); 44 KICK_WATCHDOG; 42 45 } 43 46 } -
src/tests/concurrent/signal/block.c
r85b1deb r7bdcac1 14 14 #include <time> 15 15 16 #include "long_tests.h" 17 16 18 #ifndef PREEMPTION_RATE 17 19 #define PREEMPTION_RATE 10`ms … … 22 24 } 23 25 24 #ifdef LONG_TEST26 #ifdef TEST_LONG 25 27 static const unsigned long N = 150_000ul; 26 28 #else … … 66 68 thread Waiter {}; 67 69 void main( Waiter & this ) { 68 for( int i = 0; i < N; i++ ) {70 for( int i = 0; TEST(i < N); i++ ) { 69 71 wait_op( globalA, globalB, i ); 72 KICK_WATCHDOG; 70 73 } 71 74 } -
src/tests/concurrent/signal/disjoint.c
r85b1deb r7bdcac1 4 4 #include <thread> 5 5 #include <time> 6 7 #include "long_tests.h" 6 8 7 9 #ifndef PREEMPTION_RATE … … 13 15 } 14 16 15 #ifdef LONG_TEST17 #ifdef TEST_LONG 16 18 static const unsigned long N = 300_000ul; 17 19 #else … … 71 73 if( (d.counter % 1000) == 0 ) sout | d.counter | endl; 72 74 73 return d.counter < N;75 return TEST(d.counter < N); 74 76 } 75 77 … … 77 79 78 80 void main( Waiter & this ) { 79 while( wait( mut, data ) ) { yield(); }81 while( wait( mut, data ) ) { KICK_WATCHDOG; yield(); } 80 82 } 81 83 … … 94 96 95 97 //This is technically a mutual exclusion violation but the mutex monitor protects us 96 bool running = data.counter < N&& data.counter > 0;98 bool running = TEST(data.counter < N) && data.counter > 0; 97 99 if( data.state != SIGNAL && running ) { 98 100 sout | "ERROR Eager signal" | data.state | endl; -
src/tests/concurrent/signal/wait.c
r85b1deb r7bdcac1 12 12 #include <time> 13 13 14 #include "long_tests.h" 15 14 16 #ifndef PREEMPTION_RATE 15 17 #define PREEMPTION_RATE 10`ms … … 20 22 } 21 23 22 #ifdef LONG_TEST24 #ifdef TEST_LONG 23 25 static const unsigned long N = 375_000ul; 24 26 #else … … 90 92 // Waiter ABC 91 93 void main( WaiterABC & this ) { 92 for( int i = 0; i < N; i++ ) {94 for( int i = 0; TEST(i < N); i++ ) { 93 95 wait( condABC, globalA, globalB, globalC ); 96 KICK_WATCHDOG; 94 97 } 95 98 … … 100 103 // Waiter AB 101 104 void main( WaiterAB & this ) { 102 for( int i = 0; i < N; i++ ) {105 for( int i = 0; TEST(i < N); i++ ) { 103 106 wait( condAB , globalA, globalB ); 107 KICK_WATCHDOG; 104 108 } 105 109 … … 110 114 // Waiter AC 111 115 void main( WaiterAC & this ) { 112 for( int i = 0; i < N; i++ ) {116 for( int i = 0; TEST(i < N); i++ ) { 113 117 wait( condAC , globalA, globalC ); 118 KICK_WATCHDOG; 114 119 } 115 120 … … 120 125 // Waiter BC 121 126 void main( WaiterBC & this ) { 122 for( int i = 0; i < N; i++ ) {127 for( int i = 0; TEST(i < N); i++ ) { 123 128 wait( condBC , globalB, globalC ); 129 KICK_WATCHDOG; 124 130 } 125 131
Note: See TracChangeset
for help on using the changeset viewer.