Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/concurrent/preempt.c

    rb68fc85 rb2fe1c9  
    11#include <kernel>
    22#include <thread>
    3 #include <time>
    43
    54#ifndef PREEMPTION_RATE
    6 #define PREEMPTION_RATE 10`ms
     5#define PREEMPTION_RATE 10_000ul
    76#endif
    87
    9 Duration default_preemption() {
     8unsigned int default_preemption() {
    109        return PREEMPTION_RATE;
    1110}
     
    1615static const unsigned long N = 500ul;
    1716#endif
    18 
    19 extern void __cfaabi_check_preemption();
    2017
    2118static volatile int counter = 0;
     
    3128void main(worker_t & this) {
    3229        while(counter < N) {
    33                 __cfaabi_check_preemption();
    3430                if( (counter % 7) == this.value ) {
    35                         __cfaabi_check_preemption();
    3631                        int next = __atomic_add_fetch_4(&counter, 1, __ATOMIC_SEQ_CST);
    37                         __cfaabi_check_preemption();
    3832                        if( (next % 100) == 0 ) printf("%d\n", (int)next);
    39                         __cfaabi_check_preemption();
    4033                }
    41                 __cfaabi_check_preemption();
    4234        }
    4335}
Note: See TracChangeset for help on using the changeset viewer.