Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/sched-int-wait.c

    r9fe39530 r303406a  
    1 //---------------------------------------------------------
    2 // Multi wait test
    3 // Ensures that no deadlock from waiting/signalling conditions
    4 //---------------------------------------------------------
    5 
    6 
    71#include <fstream>
    82#include <kernel>
     
    4135//----------------------------------------------------------------------------------------------------
    4236// Tools
    43 void signal( condition * cond, global_t & mutex a, global_t & mutex b ) {
     37void signal( condition * cond, global_t * mutex a, global_t * mutex b ) {
    4438        signal( cond );
    4539}
    4640
    47 void signal( condition * cond, global_t & mutex a, global_t & mutex b, global_t & mutex c ) {
     41void signal( condition * cond, global_t * mutex a, global_t * mutex b, global_t * mutex c ) {
    4842        signal( cond );
    4943}
    5044
    51 void wait( condition * cond, global_t & mutex a, global_t & mutex b ) {
     45void wait( condition * cond, global_t * mutex a, global_t * mutex b ) {
    5246        wait( cond );
    5347}
    5448
    55 void wait( condition * cond, global_t & mutex a, global_t & mutex b, global_t & mutex c ) {
     49void wait( condition * cond, global_t * mutex a, global_t * mutex b, global_t * mutex c ) {
    5650        wait( cond );
    5751}
     
    5953//----------------------------------------------------------------------------------------------------
    6054// Signaler
    61 void main( Signaler & this ) {
     55void main( Signaler* this ) {
    6256
    6357        while( waiter_left != 0 ) {
     
    6559                switch( action ) {
    6660                        case 0:
    67                                 signal( &condABC, globalA, globalB, globalC );
     61                                signal( &condABC, &globalA, &globalB, &globalC );
    6862                                break;
    6963                        case 1:
    70                                 signal( &condAB , globalA, globalB );
     64                                signal( &condAB , &globalA, &globalB );
    7165                                break;
    7266                        case 2:
    73                                 signal( &condBC , globalB, globalC );
     67                                signal( &condBC , &globalB, &globalC );
    7468                                break;
    7569                        case 3:
    76                                 signal( &condAC , globalA, globalC );
     70                                signal( &condAC , &globalA, &globalC );
    7771                                break;
    7872                        default:
     
    8680//----------------------------------------------------------------------------------------------------
    8781// Waiter ABC
    88 void main( WaiterABC & this ) {
     82void main( WaiterABC* this ) {
    8983        for( int i = 0; i < N; i++ ) {
    90                 wait( &condABC, globalA, globalB, globalC );
     84                wait( &condABC, &globalA, &globalB, &globalC );
    9185        }
    9286
     
    9690//----------------------------------------------------------------------------------------------------
    9791// Waiter AB
    98 void main( WaiterAB & this ) {
     92void main( WaiterAB* this ) {
    9993        for( int i = 0; i < N; i++ ) {
    100                 wait( &condAB , globalA, globalB );
     94                wait( &condAB , &globalA, &globalB );
    10195        }
    10296
     
    106100//----------------------------------------------------------------------------------------------------
    107101// Waiter AC
    108 void main( WaiterAC & this ) {
     102void main( WaiterAC* this ) {
    109103        for( int i = 0; i < N; i++ ) {
    110                 wait( &condAC , globalA, globalC );
     104                wait( &condAC , &globalA, &globalC );
    111105        }
    112106
     
    116110//----------------------------------------------------------------------------------------------------
    117111// Waiter BC
    118 void main( WaiterBC & this ) {
     112void main( WaiterBC* this ) {
    119113        for( int i = 0; i < N; i++ ) {
    120                 wait( &condBC , globalB, globalC );
     114                wait( &condBC , &globalB, &globalC );
    121115        }
    122116
Note: See TracChangeset for help on using the changeset viewer.