Re: [PATCH v5 2/3] examples/l2fwd: Handle SIGINT and SIGTERM in l2fwd
From: Wang, Zhihong <hidden>
Date: 2016-01-04 02:00:12
From: Wang, Zhihong <hidden>
Date: 2016-01-04 02:00:12
-----Original Message----- From: Stephen Hemminger [mailto:stephen@networkplumber.org] Sent: Friday, January 1, 2016 1:02 AM To: Wang, Zhihong <redacted> Cc: dev@dpdk.org; Ananyev, Konstantin <redacted>; Qiu, Michael [off-list ref] Subject: Re: [PATCH v5 2/3] examples/l2fwd: Handle SIGINT and SIGTERM in l2fwd On Wed, 30 Dec 2015 16:59:50 -0500 Zhihong Wang [off-list ref] wrote:quoted
+static void +signal_handler(int signum) +{ + if (signum == SIGINT || signum == SIGTERM) { + printf("\n\nSignal %d received, preparing to exit...\n", + signum); + force_quit = true;Actually, the if () is redundant since you only registered SIGINT, and SIGTERM those are the only signals you could possibly receive.
Yes it's kind of an obsession I guess, just want to make the code crystal clear :)
Acked-by: Stephen Hemminger <stephen@networkplumber.org>