Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- main() {
- Lock All Mutex;
- For(Threads T IN Gasthaus)
- ThreadMain(T);
- }
- Thread Main(Thread T) {
- IF(T == EV_SIT)
- sit();
- UNLOCK mutex_ev_sit;
- END IF
- ELSE IF( T == ED_SIT)
- sit();
- UNLOCK mutex_ed_sit;
- END IF
- ELSE IF(T == V_SIT)
- LOCK mutex_ev_sit;
- sit();
- END IF
- ELSE IF(T == D_SIT)
- LOCK mutex_ed_sit;
- sit();
- END IF
- ELSE IF(T == V_EAT)
- LOCK mutex_d_sit;
- eat();
- UNLOCK mutex_v_eat_0;
- UNLOCK mutex_v_eat_1;
- UNLOCK mutex_v_eat_2;
- UNLOCK mutex_v_eat_3;
- END IF
- ELSE IF(T == EV_EAT)
- LOCK mutex_v_eat_0;
- eat();
- END IF
- ELSE IF(T == ED_EAT)
- LOCK mutex_v_eat_1;
- eat();
- END IF
- ELSE IF(T == D_EAT)
- LOCK mutex_v_eat_2;
- eat();
- END IF
- ELSE IF(T == GUEST_EAT)
- LOCK mutex_v_eat_3;
- eat();
- END IF
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement