From 3beaa23d4d33b51a392b56f110c8773151ac19cc Mon Sep 17 00:00:00 2001 From: Vadim Kochan Date: Mon, 6 Jul 2015 12:16:14 +0300 Subject: [PATCH] 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 Signed-off-by: Daniel Borkmann --- locking.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locking.h b/locking.h index 2cb93d1a..6c8b8750 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); } -- 2.11.4.GIT