Use halfdelay(1) to poll keyboard input with delay in 1 tenth of second
and get rid of custom usleep(...) using.

With this approach (it is also used in htop tool) the key events are more
sensitive to user inputs.

Signed-off-by: Vadim Kochan <vadi...@gmail.com>
---
 flowtop.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/flowtop.c b/flowtop.c
index f382d6c..f48f5c8 100644
--- a/flowtop.c
+++ b/flowtop.c
@@ -1238,6 +1238,7 @@ static void presenter(void)
 
        screen = screen_init(false);
        wclear(screen);
+       halfdelay(1);
 
        start_color();
        INIT_COLOR(RED, BLACK);
@@ -1320,8 +1321,6 @@ static void presenter(void)
                        draw_flows(screen, &flow_list, skip_lines);
 
                draw_footer();
-
-               usleep(80000);
        }
        rcu_unregister_thread();
 
-- 
2.10.2

-- 
You received this message because you are subscribed to the Google Groups 
"netsniff-ng" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to netsniff-ng+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to