On Fri, Feb 3, 2017 at 4:19 PM, Felix Fietkau <n...@nbd.name> wrote: > On 2017-02-03 15:57, Alin Năstac wrote: >> Hi Felix, >> >> The SIGTERM ignore issue I was experiencing before is no longer >> reproducible after I apply your patch. >> >> However, I'm concerned about a possible ignore of SIGTERM signal >> received during a ubus_complete_request() call. If ctx->stack_depth is >> 0, any such signal received between prev_uloop_initialization and the >> reset of ulopp_cancelling to false will be ignored. Is this >> "uloop_cancelling = false" really necessary? >> >> BTW, I think the reset of uloop_status and uloop_cancelled should be >> executed before uloop_setup_signals() like so: >> if (!recursive_calls++) { >> uloop_status = 0; >> uloop_cancelled = false; >> uloop_setup_signals(true); >> } > I was worried about the corner case of performing a ubus request after > uloop_run has already completed. > I guess one way this could be addressed is by setting uloop_cancelled = > false at the end of uloop_run().
How about adding this uloop function: static int recursive_calls = 0; /* moved from uloop_run() context */ int uloop_cancelling() { return recursive_calls > 0 && uloop_cancelled; } This function will return true only when uloop_run() is still running, so you will no longer need to touch uloop_cancelled state at all. This way you could reduce the scope of uloop_cancelled to uloop.c too. _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel