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, 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/block.c

    rf9feab8 r90152a4  
    77
    88
    9 #include <fstream>
    10 #include <kernel>
    11 #include <monitor>
    12 #include <stdlib>
    13 #include <thread>
     9#include <fstream.hfa>
     10#include <kernel.hfa>hfa>
     11#include <monitor.hfa>
     12#include <stdlib.hfa>
     13#include <thread.hfa>
     14#include <time.hfa>
    1415
    15 #include <time.h>
    16 
    17 static const unsigned long N = 5_000ul;
     16#include "long_tests.h"
    1817
    1918#ifndef PREEMPTION_RATE
    20 #define PREEMPTION_RATE 10_000ul
     19#define PREEMPTION_RATE 10`ms
    2120#endif
    2221
    23 unsigned int default_preemption() {
     22Duration default_preemption() {
    2423        return PREEMPTION_RATE;
    2524}
     25
     26#ifdef TEST_LONG
     27static const unsigned long N = 150_000ul;
     28#else
     29static const unsigned long N = 5_000ul;
     30#endif
    2631
    2732enum state_t { WAITED, SIGNAL, BARGE };
     
    3742}
    3843
    39 void ^?{} ( global_data_t & this ) {}
     44void ^?{} ( global_data_t & mutex this ) {}
    4045
    4146global_data_t globalA, globalB;
     
    4752//------------------------------------------------------------------------------
    4853void wait_op( global_data_t & mutex a, global_data_t & mutex b, unsigned i ) {
    49         wait( cond, (uintptr_t)this_thread );
     54    wait( cond, (uintptr_t)active_thread() );
    5055
    5156        yield( random( 10 ) );
     
    5661        }
    5762
    58         a.last_thread = b.last_thread = this_thread;
     63        a.last_thread = b.last_thread = active_thread();
    5964
    6065        yield( random( 10 ) );
     
    6368thread Waiter {};
    6469void main( Waiter & this ) {
    65         for( int i = 0; i < N; i++ ) {
     70        for( int i = 0; TEST(i < N); i++ ) {
    6671                wait_op( globalA, globalB, i );
     72                KICK_WATCHDOG;
    6773        }
    6874}
     
    7278        yield( random( 10 ) );
    7379
    74         [a.last_thread, b.last_thread, a.last_signaller, b.last_signaller] = this_thread;
     80        [a.last_thread, b.last_thread, a.last_signaller, b.last_signaller] = active_thread();
    7581
    7682        if( !is_empty( cond ) ) {
     
    102108//------------------------------------------------------------------------------
    103109void barge_op( global_data_t & mutex a ) {
    104         a.last_thread = this_thread;
     110        a.last_thread = active_thread();
    105111}
    106112
     
    118124
    119125int main(int argc, char* argv[]) {
    120         random_seed( time( NULL ) );
     126        srandom( time( NULL ) );
    121127        done = false;
    122128        processor p;
Note: See TracChangeset for help on using the changeset viewer.