Advertisement
Guest User

robot

a guest
Nov 23rd, 2014
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1.         semaphore_wait(sem_Y_id,1);   // opuszczam full Y
  2.         semaphore_wait(sem_Z_id,1);   // opuszczam full Z
  3.        
  4.         semaphore_wait(sem_Y_id,2);  // opuszczam mutex
  5.         semaphore_wait(sem_Z_id,2);
  6.        
  7.         wynik = buforY[0]*10 + buforZ[0];
  8.         printf("Wyprodukowana liczba %d jako numer - %d \n",wynik,semaphore_get(sem_zlicz_id,0)+1);
  9.         shift(buforY);
  10.         shift(buforZ);
  11.         semaphore_post(sem_zlicz_id,0);
  12.        
  13.         semaphore_post(sem_Y_id,2);   //podnosze mutex
  14.         semaphore_post(sem_Z_id,2);
  15.        
  16.         semaphore_post(sem_Y_id,0);   //podnosze empty
  17.         semaphore_post(sem_Z_id,0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement