[PATCH v3 13/16] console: unconditionally run resched() in ctrlc()

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Mar 10 08:47:57 GMT 2021


From: Ahmad Fatoum <ahmad at a3f.at>

ctrlc is allowed only after init and reboot mode scripts have run, so
these scripts run uninterruptible. A side effect of this is that all
calls to ctrlc() will immediately return with false without running the
pollers. While init scripts shouldn't run too long, it's still
surprising behavior. Thus call resched() first thing in ctrlc().

Signed-off-by: Ahmad Fatoum <ahmad at a3f.at>
---
 common/console.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/console.c b/common/console.c
index a436c37aa3e8..8a0af75a1ff4 100644
--- a/common/console.c
+++ b/common/console.c
@@ -579,14 +579,14 @@ int ctrlc(void)
 {
 	int ret = 0;
 
+	resched();
+
 	if (!ctrlc_allowed)
 		return 0;
 
 	if (ctrlc_abort)
 		return 1;
 
-	resched();
-
 #ifdef ARCH_HAS_CTRLC
 	ret = arch_ctrlc();
 #else
-- 
2.29.2




More information about the barebox mailing list