Changes in src/tests/sched-int-wait.c [4cedd9f:6c7b1e7]
- File:
-
- 1 edited
-
src/tests/sched-int-wait.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/tests/sched-int-wait.c
r4cedd9f r6c7b1e7 41 41 //---------------------------------------------------------------------------------------------------- 42 42 // Tools 43 void signal( condition &cond, global_t & mutex a, global_t & mutex b ) {43 void signal( condition * cond, global_t & mutex a, global_t & mutex b ) { 44 44 signal( cond ); 45 45 } 46 46 47 void signal( condition &cond, global_t & mutex a, global_t & mutex b, global_t & mutex c ) {47 void signal( condition * cond, global_t & mutex a, global_t & mutex b, global_t & mutex c ) { 48 48 signal( cond ); 49 49 } 50 50 51 void wait( condition &cond, global_t & mutex a, global_t & mutex b ) {51 void wait( condition * cond, global_t & mutex a, global_t & mutex b ) { 52 52 wait( cond ); 53 53 } 54 54 55 void wait( condition &cond, global_t & mutex a, global_t & mutex b, global_t & mutex c ) {55 void wait( condition * cond, global_t & mutex a, global_t & mutex b, global_t & mutex c ) { 56 56 wait( cond ); 57 57 } … … 62 62 63 63 while( waiter_left != 0 ) { 64 unsigned action = rand48(4);64 unsigned action = random( 4 ); 65 65 switch( action ) { 66 66 case 0: 67 signal( condABC, globalA, globalB, globalC );67 signal( &condABC, globalA, globalB, globalC ); 68 68 break; 69 69 case 1: 70 signal( condAB , globalA, globalB );70 signal( &condAB , globalA, globalB ); 71 71 break; 72 72 case 2: 73 signal( condBC , globalB, globalC );73 signal( &condBC , globalB, globalC ); 74 74 break; 75 75 case 3: 76 signal( condAC , globalA, globalC );76 signal( &condAC , globalA, globalC ); 77 77 break; 78 78 default: … … 88 88 void main( WaiterABC & this ) { 89 89 for( int i = 0; i < N; i++ ) { 90 wait( condABC, globalA, globalB, globalC );90 wait( &condABC, globalA, globalB, globalC ); 91 91 } 92 92 … … 98 98 void main( WaiterAB & this ) { 99 99 for( int i = 0; i < N; i++ ) { 100 wait( condAB , globalA, globalB );100 wait( &condAB , globalA, globalB ); 101 101 } 102 102 … … 108 108 void main( WaiterAC & this ) { 109 109 for( int i = 0; i < N; i++ ) { 110 wait( condAC , globalA, globalC );110 wait( &condAC , globalA, globalC ); 111 111 } 112 112 … … 118 118 void main( WaiterBC & this ) { 119 119 for( int i = 0; i < N; i++ ) { 120 wait( condBC , globalB, globalC );120 wait( &condBC , globalB, globalC ); 121 121 } 122 122 … … 127 127 // Main 128 128 int main(int argc, char* argv[]) { 129 rand 48seed( time( NULL ) );129 random_seed( time( NULL ) ); 130 130 waiter_left = 4; 131 131 processor p[2];
Note:
See TracChangeset
for help on using the changeset viewer.