summaryrefslogtreecommitdiff
path: root/locking.h
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2015-07-06 12:16:14 +0300
committerDaniel Borkmann <daniel@iogearbox.net>2015-07-13 10:42:32 +0200
commit3beaa23d4d33b51a392b56f110c8773151ac19cc (patch)
tree2f5789a584acdde540be3a7cebac59b88bfdfa12 /locking.h
parent49be1bd2f5f5c712e6828f659d4fbb9e27543391 (diff)
flowtop: Fix hanging while waiting for collector
Fixed issue when flowtop hangs be cause of wrong using pthread cond lockiing, so the lock should be locked first by calling thread before call to pthread_cond_wait. Fixes: 451275470106 ("flowtop: Don't init screen until collector is ready") Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'locking.h')
-rw-r--r--locking.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/locking.h b/locking.h
index 2cb93d1..6c8b875 100644
--- a/locking.h
+++ b/locking.h
@@ -97,6 +97,7 @@ static inline void condlock_init(struct condlock *c)
{
pthread_mutex_init(&c->lock, NULL);
pthread_cond_init(&c->cond, NULL);
+ pthread_mutex_lock(&c->lock);
}
static inline void condlock_signal(struct condlock *c)
@@ -108,7 +109,6 @@ static inline void condlock_signal(struct condlock *c)
static inline void condlock_wait(struct condlock *c)
{
- pthread_mutex_lock(&c->lock);
pthread_cond_wait(&c->cond, &c->lock);
pthread_mutex_unlock(&c->lock);
}