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