diff options
author | Vadim Kochan <vadim4j@gmail.com> | 2015-07-18 14:12:49 +0300 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2015-07-20 09:58:41 +0200 |
commit | bcc10fdc239d2fe7073637df4febfe60463b4b46 (patch) | |
tree | df3d5183e7a84eb72d769768317dedd46fb0d363 | |
parent | 9a89c1d813fbb762b801e99d6bc0801a45b7f49a (diff) |
Revert "flowtop: Don't init screen until collector is ready"
Follow-up of commit 9a89c1d813fb ("Revert "flowtop: Fix hanging
while waiting for collector"") which both address the clean up
in the panic handler.
This reverts commit 451275470106024f106a310a5af050b3ca046a4f.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-rw-r--r-- | flowtop.c | 9 | ||||
-rw-r--r-- | locking.h | 31 |
2 files changed, 0 insertions, 40 deletions
@@ -85,7 +85,6 @@ struct flow_list { static volatile sig_atomic_t sigint = 0; static int what = INCLUDE_IPV4 | INCLUDE_IPV6 | INCLUDE_TCP, show_src = 0; static struct flow_list flow_list; -static struct condlock collector_ready; static int nfct_acct_val = -1; static const char *short_options = "vhTUsDIS46u"; @@ -1038,8 +1037,6 @@ static void presenter(void) int skip_lines = 0; WINDOW *screen; - condlock_wait(&collector_ready); - lookup_init_ports(PORTS_TCP); lookup_init_ports(PORTS_UDP); screen = screen_init(false); @@ -1250,8 +1247,6 @@ static void *collector(void *null __maybe_unused) panic("Cannot set non-blocking socket: fcntl(): %s\n", strerror(errno)); - condlock_signal(&collector_ready); - rcu_register_thread(); while (!sigint && ret >= 0) { @@ -1350,16 +1345,12 @@ int main(int argc, char **argv) init_geoip(1); - condlock_init(&collector_ready); - ret = pthread_create(&tid, NULL, collector, NULL); if (ret < 0) panic("Cannot create phthread!\n"); presenter(); - condlock_destroy(&collector_ready); - destroy_geoip(); restore_sysctl(&nfct_acct_val); @@ -17,11 +17,6 @@ struct rwlock { pthread_rwlock_t lock; }; -struct condlock { - pthread_mutex_t lock; - pthread_cond_t cond; -}; - static inline int spinlock_init(struct spinlock *l) { return -pthread_spin_init(&l->lock, 0); @@ -93,30 +88,4 @@ static inline void rwlock_unlock(struct rwlock *l) pthread_rwlock_unlock(&l->lock); } -static inline void condlock_init(struct condlock *c) -{ - pthread_mutex_init(&c->lock, NULL); - pthread_cond_init(&c->cond, NULL); -} - -static inline void condlock_signal(struct condlock *c) -{ - pthread_mutex_lock(&c->lock); - pthread_cond_signal(&c->cond); - pthread_mutex_unlock(&c->lock); -} - -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); -} - -static inline void condlock_destroy(struct condlock *c) -{ - pthread_mutex_destroy(&c->lock); - pthread_cond_destroy(&c->cond); -} - #endif /* LOCKING_H */ |