Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- binarysem semafor1;
- binarysem semafor2;
- binarysem semafor3;
- void proc1 ()
- {
- wait(semafor1);
- cout << "proces nr.1 " << endl;
- signal(semafor2);
- }
- void proc2 ()
- {
- wait(semafor2);
- cout << "proces nr.2 " << endl;
- signal(semafor3);
- }
- void proc3 ()
- {
- wait(semafor3);
- cout << "proces nr.3 " << endl;
- signal(semafor3);
- }
- main()
- {
- cobegin {
- initialsem(semafor1,1);
- initialsem(semafor2,0);
- initialsem(semafor3,0);
- proc1();
- proc2();
- proc3();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement