-
Notifications
You must be signed in to change notification settings - Fork 0
/
zad6.h
36 lines (31 loc) · 1.05 KB
/
zad6.h
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
/*
* Daniel Dubiel
* 291111
*/
#include <unistd.h>
#include <signal.h>
#define SEM_NAME_1 "/empty_pot"
#define SEM_NAME_2 "/full_pot"
#define SEM_NAME_3 "/mutex_6"
#define SEM_NAME_4 "/pot_6"
#define SAVAGES 1000
#define MAX_SERVINGS 10
#define wait_with_perror(X) \
do \
{ \
if (sem_wait(X) < 0) \
{ \
perror("sem_wait(3) failed on child"); \
} \
} while (0)
#define post_with_perror(X) \
do \
{ \
if (sem_post(X) < 0) \
{ \
perror("sem_wait(3) failed on child"); \
} \
} while (0)
void create_cook();
void create_savages();
void clean();