From bed406a8fce9eb683059a3138dd33e4cf7bd71cd Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Mon, 21 Oct 2013 08:59:03 +0200 Subject: [PATCH] utils channel: Normalize time before passing it to phtread_cond_timedwait. --- src/utils/channel.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/utils/channel.c b/src/utils/channel.c index af41b47..8e55ae5 100644 --- a/src/utils/channel.c +++ b/src/utils/channel.c @@ -210,6 +210,11 @@ sdb_channel_select(sdb_channel_t *chan, int *wantread, void *read_data, abstime.tv_sec += timeout->tv_sec; abstime.tv_nsec += timeout->tv_nsec; + if (abstime.tv_nsec > 1000000000) { + abstime.tv_nsec -= 1000000000; + abstime.tv_sec += 1; + } + status = pthread_cond_timedwait(&chan->cond, &chan->lock, &abstime); } -- 2.30.2