-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathactors.h
executable file
·48 lines (36 loc) · 865 Bytes
/
actors.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
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef ACTORS_H
#define ACTORS_H
#include "arrayqueue.h"
#include "cacti.h"
#include <pthread.h>
#include <semaphore.h>
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
#include <unistd.h>
/* actor type */
typedef struct actor {
messages_queue_t *msg_q;
role_t *role;
bool dead;
bool ready_to_handling;
void **stateptr;
actor_id_t *my_id;
} actor_t;
actor_t *new_actor(role_t *role);
void destroy_actor(actor_t *act);
/* dynamic vector of actor_t */
typedef struct actors_vector {
actor_t *body;
actor_id_t count;
actor_id_t size;
} actors_vector_t;
actors_vector_t *av_new(size_t start_size);
bool av_push_back(actors_vector_t *v, actor_t *act);
void av_destroy(actors_vector_t *av);
#endif /* ACTORS_H */