Changeset 90152a4 for tests/concurrent/preempt.c
- Timestamp:
- Aug 27, 2018, 4:40:34 PM (7 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
- 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/preempt.c (moved) (moved from src/tests/concurrent/preempt.c ) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrent/preempt.c
rf9feab8 r90152a4 1 #include <kernel> 2 #include <thread> 1 #include <kernel.hfa>hfa> 2 #include <thread.hfa> 3 #include <time.hfa> 4 5 #include "long_tests.h" 3 6 4 7 #ifndef PREEMPTION_RATE 5 #define PREEMPTION_RATE 10 _000ul8 #define PREEMPTION_RATE 10`ms 6 9 #endif 7 10 8 unsigned intdefault_preemption() {11 Duration default_preemption() { 9 12 return PREEMPTION_RATE; 10 13 } 14 15 #ifdef TEST_LONG 16 static const unsigned long N = 30_000ul; 17 #else 18 static const unsigned long N = 500ul; 19 #endif 20 21 extern void __cfaabi_check_preemption(); 11 22 12 23 static volatile int counter = 0; … … 21 32 22 33 void main(worker_t & this) { 23 while(counter < 1000) { 34 while(TEST(counter < N)) { 35 __cfaabi_check_preemption(); 24 36 if( (counter % 7) == this.value ) { 37 __cfaabi_check_preemption(); 25 38 int next = __atomic_add_fetch_4(&counter, 1, __ATOMIC_SEQ_CST); 39 __cfaabi_check_preemption(); 26 40 if( (next % 100) == 0 ) printf("%d\n", (int)next); 41 __cfaabi_check_preemption(); 27 42 } 43 __cfaabi_check_preemption(); 44 KICK_WATCHDOG; 28 45 } 29 46 }
Note:
See TracChangeset
for help on using the changeset viewer.