Ignore:
Timestamp:
Aug 27, 2018, 4:40:34 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
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.
Message:

Merge branch 'master' into cleanup-dtors

File:
1 moved

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"
    36
    47#ifndef PREEMPTION_RATE
    5 #define PREEMPTION_RATE 10_000ul
     8#define PREEMPTION_RATE 10`ms
    69#endif
    710
    8 unsigned int default_preemption() {
     11Duration default_preemption() {
    912        return PREEMPTION_RATE;
    1013}
     14
     15#ifdef TEST_LONG
     16static const unsigned long N = 30_000ul;
     17#else
     18static const unsigned long N = 500ul;
     19#endif
     20
     21extern void __cfaabi_check_preemption();
    1122
    1223static volatile int counter = 0;
     
    2132
    2233void main(worker_t & this) {
    23         while(counter < 1000) {
     34        while(TEST(counter < N)) {
     35                __cfaabi_check_preemption();
    2436                if( (counter % 7) == this.value ) {
     37                        __cfaabi_check_preemption();
    2538                        int next = __atomic_add_fetch_4(&counter, 1, __ATOMIC_SEQ_CST);
     39                        __cfaabi_check_preemption();
    2640                        if( (next % 100) == 0 ) printf("%d\n", (int)next);
     41                        __cfaabi_check_preemption();
    2742                }
     43                __cfaabi_check_preemption();
     44                KICK_WATCHDOG;
    2845        }
    2946}
Note: See TracChangeset for help on using the changeset viewer.