/
blackboard.h
58 lines (47 loc) · 1.66 KB
/
blackboard.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
49
50
51
52
53
54
55
56
57
58
/*
* POK header
*
* The following file is a part of the POK project. Any modification should
* be made according to the POK licence. You CANNOT use this file or a part
* of a file for your own project.
*
* For more information on the POK licence, please see our LICENCE FILE
*
* Please follow the coding guidelines described in doc/CODING_GUIDELINES
*
* Copyright (c) 2007-2021 POK team
*/
#ifndef __POK_USER_BLACKBOARD_H__
#define __POK_USER_BLACKBOARD_H__
#ifdef POK_NEEDS_MIDDLEWARE
#ifdef POK_NEEDS_BLACKBOARDS
#include <errno.h>
#include <types.h>
typedef struct {
pok_size_t size;
pok_bool_t empty;
pok_range_t waiting_processes;
pok_size_t index;
pok_bool_t ready;
pok_event_id_t lock;
} pok_blackboard_t;
typedef struct {
pok_port_size_t msg_size;
pok_bool_t empty;
pok_range_t waiting_processes;
} pok_blackboard_status_t;
pok_ret_t pok_blackboard_create(char *name, const pok_size_t msg_size,
pok_blackboard_id_t *id);
pok_ret_t pok_blackboard_read(const pok_blackboard_id_t id,
const uint64_t timeout, void *data,
pok_port_size_t *len);
pok_ret_t pok_blackboard_display(const pok_blackboard_id_t id,
const void *message,
const pok_port_size_t len);
pok_ret_t pok_blackboard_clear(const pok_blackboard_id_t id);
pok_ret_t pok_blackboard_id(char *name, pok_blackboard_id_t *id);
pok_ret_t pok_blackboard_status(const pok_blackboard_id_t id,
pok_blackboard_status_t *status);
#endif
#endif
#endif