summaryrefslogtreecommitdiff
path: root/src/lib/shm_flow_set.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2022-03-29 20:43:20 +0200
committerSander Vrijders <sander@ouroboros.rocks>2022-03-30 15:12:25 +0200
commit8a1f7dc159cc7a85e92975e1b25fdce1368e8c8e (patch)
tree37f51528030dfe81d9568006c33ae3af65d49305 /src/lib/shm_flow_set.c
parente38f7c74dc0383fc5daf3eea7a7ab63fae6379fa (diff)
downloadouroboros-8a1f7dc159cc7a85e92975e1b25fdce1368e8c8e.tar.gz
ouroboros-8a1f7dc159cc7a85e92975e1b25fdce1368e8c8e.zip
lib: Use struct portevent internally
The fqueues were relying on the fact that the portevent were two integers. This cleans that up a bit. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/lib/shm_flow_set.c')
-rw-r--r--src/lib/shm_flow_set.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/lib/shm_flow_set.c b/src/lib/shm_flow_set.c
index d325a253..25e7e32b 100644
--- a/src/lib/shm_flow_set.c
+++ b/src/lib/shm_flow_set.c
@@ -63,11 +63,6 @@
#define fqueue_ptr(fs, idx) (fs->fqueues + (SHM_BUFFER_SIZE) * idx)
-struct portevent {
- int flow_id;
- int event;
-};
-
struct shm_flow_set {
ssize_t * mtable;
size_t * heads;
@@ -307,6 +302,8 @@ void shm_flow_set_notify(struct shm_flow_set * set,
int flow_id,
int event)
{
+ struct portevent * e;
+
assert(set);
assert(!(flow_id < 0) && flow_id < SYS_MAX_FLOWS);
@@ -317,10 +314,14 @@ void shm_flow_set_notify(struct shm_flow_set * set,
return;
}
- (fqueue_ptr(set, set->mtable[flow_id]) +
- (set->heads[set->mtable[flow_id]]))->flow_id = flow_id;
- (fqueue_ptr(set, set->mtable[flow_id]) +
- (set->heads[set->mtable[flow_id]])++)->event = event;
+
+ e = fqueue_ptr(set, set->mtable[flow_id]) +
+ set->heads[set->mtable[flow_id]];
+
+ e->flow_id = flow_id;
+ e->event = event;
+
+ ++set->heads[set->mtable[flow_id]];
pthread_cond_signal(&set->conds[set->mtable[flow_id]]);
@@ -330,7 +331,7 @@ void shm_flow_set_notify(struct shm_flow_set * set,
ssize_t shm_flow_set_wait(const struct shm_flow_set * set,
size_t idx,
- int * fqueue,
+ struct portevent * fqueue,
const struct timespec * abstime)
{
ssize_t ret = 0;