20 lines
240 B
Plaintext
20 lines
240 B
Plaintext
binarysem s;
|
|
int suma=0;
|
|
|
|
void dodawanie (int ile){
|
|
int i;
|
|
for(i=0; i<ile; i=i+1){
|
|
wait(s);
|
|
suma=suma+1;
|
|
signal(s);
|
|
}
|
|
}
|
|
|
|
main(){
|
|
initialsem(s, 1);
|
|
cobegin{
|
|
dodawanie(10); dodawanie(10);
|
|
}
|
|
cout << "Suma = " << suma << endl;
|
|
}
|