/
portal.h
47 lines (39 loc) · 1.03 KB
/
portal.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
#pragma once
#ifdef __cplusplus
extern "C" {
#else
#define false 0
#define true 1
typedef unsigned char bool;
#endif
struct portal;
struct message
{
size_t data[4];
};
/*
* Dummy typedefs for messages.
*/
typedef struct message message_t;
/*
* portal_alloc()
* Allocate a new portal for each part.
*/
void portal_alloc(struct portal *portals[]);
/*
* portal_alloc()
* Free the portals for each part.
*/
void portal_free(struct portal *portals[]);
void portal_write(struct portal *portal, message_t *msg, int *test);
void portal_write_and_notify(struct portal *portal, message_t *msg);
void portal_notify(struct portal *portal);
void portal_read_msg(message_t *queue, message_t *target);
void portal_wait(struct portal *portal);
size_t portal_pending(struct portal *portal, message_t **msgs);
void portal_read(struct portal *portal, size_t count);
void portal_sync_query(struct portal *portal, message_t *msg, size_t msg_id);
void portal_sync_reply(struct portal *portal, message_t *msg, size_t msg_id);
#ifdef __cplusplus
}
#endif