[PATCH 3/3] commands: readline: release command slice

Rouven Czerwinski r.czerwinski at pengutronix.de
Wed Feb 10 06:58:10 EST 2021


Release the command slice around readline to let the workqueues run
while waiting for input.

Signed-off-by: Rouven Czerwinski <r.czerwinski at pengutronix.de>
---
 commands/readline.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/commands/readline.c b/commands/readline.c
index 796b4def95..ece25d12f5 100644
--- a/commands/readline.c
+++ b/commands/readline.c
@@ -5,6 +5,7 @@
 #include <common.h>
 #include <environment.h>
 #include <malloc.h>
+#include <slice.h>
 #include <xfuncs.h>
 
 static int do_readline(int argc, char *argv[])
@@ -14,11 +15,16 @@ static int do_readline(int argc, char *argv[])
 	if (argc < 3)
 		return COMMAND_ERROR_USAGE;
 
+	command_slice_release();
+
 	if (readline(argv[1], buf, CONFIG_CBSIZE) < 0) {
+		command_slice_acquire();
 		free(buf);
 		return COMMAND_ERROR;
 	}
 
+	command_slice_acquire();
+
 	setenv(argv[2], buf);
 	free(buf);
 
-- 
2.30.0




More information about the barebox mailing list