blob: 68a784c806d8630125bfa6187af19d4ec12a69a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include "common.h"
const char* logPrefix = "";
int main()
{
Sem s(0x3db00001);
if (s.check() == success)
printf("free \n");
else
printf("locked \n");
printf("inc\n");
s.inc();
printf("inc done\n");
sleep(5);
s.inc();
printf("inc done\n");
sleep(5);
s.v();
s.v();
if (s.check() == success)
printf("free \n");
else
printf("locked \n");
return 0;
}
|