Pliki_SOP/zajecia6/zad2.lst
2018-12-05 18:09:07 +01:00

23 lines
566 B
Plaintext

BACI System: C-- to PCODE Compiler in C, 11:30 1 Oct 2012
Source file: zad2.cm Mon Nov 19 16:19:44 2018
line pc
1 0 binarysem s;
2 0 int suma=0;
3 0
4 0 void dodawanie (int ile){
5 0 int i;
6 0 for(i=0; i<ile; i=i+1){
7 14 wait(s);
8 16 suma=suma+1;
9 21 signal(s);
10 23 }
11 24 }
12 25
13 25 main(){
14 26 initialsem(s, 1);
15 29 cobegin{
16 30 dodawanie(10); dodawanie(10);
17 38 }
18 39 cout << "Suma = " << suma << endl;
19 43 }