summaryrefslogtreecommitdiff
path: root/src/lib/shm_flow_set.c
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-08-17 16:09:24 +0000
committerdimitri staessens <dimitri.staessens@ugent.be>2017-08-17 16:09:24 +0000
commiteefae235dd7af96eef3dc4f82f706170c379d260 (patch)
tree3959a7206bfa3b5de2881d4404a2746a75aaefda /src/lib/shm_flow_set.c
parentc7cb10810c447579cb20a8bc99049baeeb8e2065 (diff)
parent4d9c4025222e19dac9a90cabe8bd886e47959ad6 (diff)
downloadouroboros-eefae235dd7af96eef3dc4f82f706170c379d260.tar.gz
ouroboros-eefae235dd7af96eef3dc4f82f706170c379d260.zip
Merged in sandervrijders/ouroboros/be-frct (pull request #555)
lib: Add basic FRCT mechanisms
Diffstat (limited to 'src/lib/shm_flow_set.c')
-rw-r--r--src/lib/shm_flow_set.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/lib/shm_flow_set.c b/src/lib/shm_flow_set.c
index cd6946d4..2f1d4e33 100644
--- a/src/lib/shm_flow_set.c
+++ b/src/lib/shm_flow_set.c
@@ -326,10 +326,9 @@ 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,
- const struct timespec * timeout)
+ const struct timespec * abstime)
{
ssize_t ret = 0;
- struct timespec abstime;
assert(set);
assert(idx < AP_MAX_FQUEUES);
@@ -341,19 +340,15 @@ ssize_t shm_flow_set_wait(const struct shm_flow_set * set,
if (pthread_mutex_lock(set->lock) == EOWNERDEAD)
pthread_mutex_consistent(set->lock);
#endif
- if (timeout != NULL) {
- clock_gettime(PTHREAD_COND_CLOCK, &abstime);
- ts_add(&abstime, timeout, &abstime);
- }
pthread_cleanup_push((void(*)(void *))pthread_mutex_unlock,
(void *) set->lock);
while (set->heads[idx] == 0 && ret != -ETIMEDOUT) {
- if (timeout != NULL)
+ if (abstime != NULL)
ret = -pthread_cond_timedwait(set->conds + idx,
set->lock,
- &abstime);
+ abstime);
else
ret = -pthread_cond_wait(set->conds + idx,
set->lock);