Pliki_SOP/zajecia6/zad3.lst

32 lines
710 B
Plaintext
Raw Normal View History

2018-12-05 18:09:07 +01:00
BACI System: C-- to PCODE Compiler in C, 11:30 1 Oct 2012
Source file: zad3.cm Mon Nov 19 16:51:42 2018
line pc
1 0 semaphore se;
2 0 int liczba1=0;
3 0 int liczba2=0;
4 0 int s=0;
5 0
6 0 void suma(){
7 0 wait(se);
8 2 wait(se);
9 4 s=liczba1+liczba2;
10 9 }
11 10
12 10 void a(){
13 10 liczba1=10;
14 13 signal(se);
15 15 }
16 16
17 16 void b(){
18 16 liczba2=5;
19 19 signal(se);
20 21 }
21 22
22 22 main(){
23 23 initialsem(se, 0);
24 26 cobegin{
25 27 a(); b(); suma();
26 36 }
27 37 cout << "Suma = " << s << endl;
28 41 }