summaryrefslogtreecommitdiff
path: root/src/irmd/proc_table.c
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2023-03-14 12:50:26 +0100
committerSander Vrijders <[email protected]>2023-03-18 17:12:27 +0100
commit3b2f38aeafa1d6d2976dd5581ef46a5d3b463825 (patch)
treeb6672c1baaa813fb5f8865675a322efa280ab532 /src/irmd/proc_table.c
parented90f46a8207cb1289704ea64bc490d5835f3010 (diff)
downloadouroboros-3b2f38aeafa1d6d2976dd5581ef46a5d3b463825.tar.gz
ouroboros-3b2f38aeafa1d6d2976dd5581ef46a5d3b463825.zip
irmd: Use deadline instead of timeout in mainloop
Reduces the places where we need to do this conversion for pthread_cond_timedwait. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/irmd/proc_table.c')
-rw-r--r--src/irmd/proc_table.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/irmd/proc_table.c b/src/irmd/proc_table.c
index 8a25831a..ee87813d 100644
--- a/src/irmd/proc_table.c
+++ b/src/irmd/proc_table.c
@@ -184,19 +184,13 @@ void proc_entry_del_name(struct proc_entry * e,
}
int proc_entry_sleep(struct proc_entry * e,
- struct timespec * timeo)
+ struct timespec * dl)
{
- struct timespec dl;
int ret = 0;
assert(e);
- if (timeo != NULL) {
- clock_gettime(PTHREAD_COND_CLOCK, &dl);
- ts_add(&dl, timeo, &dl);
- }
-
pthread_mutex_lock(&e->lock);
if (e->state != PROC_WAKE && e->state != PROC_DESTROY)
@@ -205,8 +199,8 @@ int proc_entry_sleep(struct proc_entry * e,
pthread_cleanup_push(cancel_proc_entry, e);
while (e->state == PROC_SLEEP && ret != -ETIMEDOUT)
- if (timeo)
- ret = -pthread_cond_timedwait(&e->cond, &e->lock, &dl);
+ if (dl != NULL)
+ ret = -pthread_cond_timedwait(&e->cond, &e->lock, dl);
else
ret = -pthread_cond_wait(&e->cond, &e->lock);