Changes in src/tests/concurrent/preempt.c [b68fc85:b2fe1c9]
- File:
-
- 1 edited
-
src/tests/concurrent/preempt.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/tests/concurrent/preempt.c
rb68fc85 rb2fe1c9 1 1 #include <kernel> 2 2 #include <thread> 3 #include <time>4 3 5 4 #ifndef PREEMPTION_RATE 6 #define PREEMPTION_RATE 10 `ms5 #define PREEMPTION_RATE 10_000ul 7 6 #endif 8 7 9 Durationdefault_preemption() {8 unsigned int default_preemption() { 10 9 return PREEMPTION_RATE; 11 10 } … … 16 15 static const unsigned long N = 500ul; 17 16 #endif 18 19 extern void __cfaabi_check_preemption();20 17 21 18 static volatile int counter = 0; … … 31 28 void main(worker_t & this) { 32 29 while(counter < N) { 33 __cfaabi_check_preemption();34 30 if( (counter % 7) == this.value ) { 35 __cfaabi_check_preemption();36 31 int next = __atomic_add_fetch_4(&counter, 1, __ATOMIC_SEQ_CST); 37 __cfaabi_check_preemption();38 32 if( (next % 100) == 0 ) printf("%d\n", (int)next); 39 __cfaabi_check_preemption();40 33 } 41 __cfaabi_check_preemption();42 34 } 43 35 }
Note:
See TracChangeset
for help on using the changeset viewer.