Ignore:
Timestamp:
Aug 27, 2018, 4:40:34 PM (8 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, stuck-waitfor-destruct
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/signal/disjoint.c

    rf9feab8 r90152a4  
    1 #include <fstream>
    2 #include <kernel>
    3 #include <monitor>
    4 #include <thread>
     1#include <fstream.hfa>
     2#include <kernel.hfa>hfa>
     3#include <monitor.hfa>
     4#include <thread.hfa>
     5#include <time.hfa>
    56
    6 #include <time.h>
    7 
    8 static const unsigned long N = 10_000ul;
     7#include "long_tests.h"
    98
    109#ifndef PREEMPTION_RATE
    11 #define PREEMPTION_RATE 10_000ul
     10#define PREEMPTION_RATE 10`ms
    1211#endif
    1312
    14 unsigned int default_preemption() {
     13Duration default_preemption() {
    1514        return PREEMPTION_RATE;
    1615}
     16
     17#ifdef TEST_LONG
     18static const unsigned long N = 300_000ul;
     19#else
     20static const unsigned long N = 10_000ul;
     21#endif
    1722
    1823enum state_t { WAIT, SIGNAL, BARGE };
     
    2328monitor global_data_t;
    2429void ?{}( global_data_t & this );
    25 void ^?{} ( global_data_t & this );
     30void ^?{} ( global_data_t & mutex this );
    2631
    2732monitor global_data_t {
     
    3944}
    4045
    41 void ^?{} ( global_data_t & this ) {}
     46void ^?{} ( global_data_t & mutex this ) {}
    4247
    4348//------------------------------------------------------------------------------
     
    6469        }
    6570
    66         d.counter++;
     71        #if !defined(TEST_FOREVER)
     72                d.counter++;
     73                if( (d.counter % 1000) == 0 ) sout | d.counter | endl;
     74        #endif
    6775
    68         if( (d.counter % 1000) == 0 ) sout | d.counter | endl;
    69 
    70         return d.counter < N;
     76        return TEST(d.counter < N);
    7177}
    7278
     
    7480
    7581void main( Waiter & this ) {
    76         while( wait( mut, data ) ) { yield(); }
     82        while( wait( mut, data ) ) { KICK_WATCHDOG; yield(); }
    7783}
    7884
     
    9197
    9298        //This is technically a mutual exclusion violation but the mutex monitor protects us
    93         bool running = data.counter < N && data.counter > 0;
     99        bool running = TEST(data.counter < N) && data.counter > 0;
    94100        if( data.state != SIGNAL && running ) {
    95101                sout | "ERROR Eager signal" | data.state | endl;
     
    109115// Main loop
    110116int main(int argc, char* argv[]) {
    111         random_seed( time( NULL ) );
     117        srandom( time( NULL ) );
    112118        all_done = false;
    113119        processor p;
Note: See TracChangeset for help on using the changeset viewer.