27 lines
270 B
Plaintext
27 lines
270 B
Plaintext
semaphore s;
|
|
semaphore t;
|
|
|
|
void a(){
|
|
cout << "Proces 1" <<endl;
|
|
signal(s);
|
|
}
|
|
|
|
void b(){
|
|
wait(s);
|
|
cout <<"Proces 2" <<endl;
|
|
signal(t);
|
|
}
|
|
|
|
void c(){
|
|
wait(t);
|
|
cout <<"Proces 3" <<endl;
|
|
}
|
|
|
|
main(){
|
|
initialsem(s, 0);
|
|
initialsem(t, 0);
|
|
cobegin{
|
|
a(); b(); c();
|
|
}
|
|
}
|