diff options
author | Vadim Kochan <vadim4j@gmail.com> | 2015-07-06 12:16:14 +0300 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2015-07-13 10:42:32 +0200 |
commit | 3beaa23d4d33b51a392b56f110c8773151ac19cc (patch) | |
tree | 2f5789a584acdde540be3a7cebac59b88bfdfa12 | |
parent | 49be1bd2f5f5c712e6828f659d4fbb9e27543391 (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>
-rw-r--r-- | locking.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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); } |