Changes in src/tests/sched-int-wait.c [9fe39530:303406a]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/sched-int-wait.c
r9fe39530 r303406a 1 //---------------------------------------------------------2 // Multi wait test3 // Ensures that no deadlock from waiting/signalling conditions4 //---------------------------------------------------------5 6 7 1 #include <fstream> 8 2 #include <kernel> … … 41 35 //---------------------------------------------------------------------------------------------------- 42 36 // Tools 43 void signal( condition * cond, global_t & mutex a, global_t &mutex b ) {37 void signal( condition * cond, global_t * mutex a, global_t * mutex b ) { 44 38 signal( cond ); 45 39 } 46 40 47 void signal( condition * cond, global_t & mutex a, global_t & mutex b, global_t &mutex c ) {41 void signal( condition * cond, global_t * mutex a, global_t * mutex b, global_t * mutex c ) { 48 42 signal( cond ); 49 43 } 50 44 51 void wait( condition * cond, global_t & mutex a, global_t &mutex b ) {45 void wait( condition * cond, global_t * mutex a, global_t * mutex b ) { 52 46 wait( cond ); 53 47 } 54 48 55 void wait( condition * cond, global_t & mutex a, global_t & mutex b, global_t &mutex c ) {49 void wait( condition * cond, global_t * mutex a, global_t * mutex b, global_t * mutex c ) { 56 50 wait( cond ); 57 51 } … … 59 53 //---------------------------------------------------------------------------------------------------- 60 54 // Signaler 61 void main( Signaler &this ) {55 void main( Signaler* this ) { 62 56 63 57 while( waiter_left != 0 ) { … … 65 59 switch( action ) { 66 60 case 0: 67 signal( &condABC, globalA, globalB,globalC );61 signal( &condABC, &globalA, &globalB, &globalC ); 68 62 break; 69 63 case 1: 70 signal( &condAB , globalA,globalB );64 signal( &condAB , &globalA, &globalB ); 71 65 break; 72 66 case 2: 73 signal( &condBC , globalB,globalC );67 signal( &condBC , &globalB, &globalC ); 74 68 break; 75 69 case 3: 76 signal( &condAC , globalA,globalC );70 signal( &condAC , &globalA, &globalC ); 77 71 break; 78 72 default: … … 86 80 //---------------------------------------------------------------------------------------------------- 87 81 // Waiter ABC 88 void main( WaiterABC &this ) {82 void main( WaiterABC* this ) { 89 83 for( int i = 0; i < N; i++ ) { 90 wait( &condABC, globalA, globalB,globalC );84 wait( &condABC, &globalA, &globalB, &globalC ); 91 85 } 92 86 … … 96 90 //---------------------------------------------------------------------------------------------------- 97 91 // Waiter AB 98 void main( WaiterAB &this ) {92 void main( WaiterAB* this ) { 99 93 for( int i = 0; i < N; i++ ) { 100 wait( &condAB , globalA,globalB );94 wait( &condAB , &globalA, &globalB ); 101 95 } 102 96 … … 106 100 //---------------------------------------------------------------------------------------------------- 107 101 // Waiter AC 108 void main( WaiterAC &this ) {102 void main( WaiterAC* this ) { 109 103 for( int i = 0; i < N; i++ ) { 110 wait( &condAC , globalA,globalC );104 wait( &condAC , &globalA, &globalC ); 111 105 } 112 106 … … 116 110 //---------------------------------------------------------------------------------------------------- 117 111 // Waiter BC 118 void main( WaiterBC &this ) {112 void main( WaiterBC* this ) { 119 113 for( int i = 0; i < N; i++ ) { 120 wait( &condBC , globalB,globalC );114 wait( &condBC , &globalB, &globalC ); 121 115 } 122 116
Note: See TracChangeset
for help on using the changeset viewer.