Newer
Older
#ifndef fonctions_h
#define fonctions_h
typedef struct node {
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
struct node *next;
} node_t;
typedef struct list {
node_t *first;
node_t *last;
int length;
} list_t;
typedef struct node2 {
list_t *diviseurs;
struct node2 *next;
} node_lst;
typedef struct list2 {
node_lst *first;
node_lst *last;
int length;
} list_lst;
typedef struct buffer1 {
list_t *numbers;
sem_t free;
sem_t full;
pthread_mutex_t mutex;
bool can_stop;
} buffer1;
typedef struct buffer2 {
list_lst *prime_numbers;
sem_t free;
sem_t full;
pthread_mutex_t mutex;
} buffer2;
void init_list_t(list_t *my_list);
void init_list_lst(list_lst *my_list);
list_t *get_node_lst(list_lst *my_list);
void clear_list_t(list_t *my_list);
buffer1 *init_buffer_1(int nthreads);
buffer2 *init_buffer_2(int nthreads);
#endif //fonctions_h