summaryrefslogtreecommitdiff
path: root/src/user/knob/task.c
diff options
context:
space:
mode:
authorBenji Dial <benji6283@gmail.com>2020-09-13 19:51:09 -0400
committerBenji Dial <benji6283@gmail.com>2020-09-13 19:51:09 -0400
commit143156f63e2448733f1a35a74e629fe0ae9bb567 (patch)
treebcf70a6940038986da2cfb2d6ed380ed8ebb91de /src/user/knob/task.c
parent54101cf327b7def90636babbadbb66ce697298ee (diff)
downloadportland-os-143156f63e2448733f1a35a74e629fe0ae9bb567.tar.gz
have command shell block while commands are running
Diffstat (limited to 'src/user/knob/task.c')
-rw-r--r--src/user/knob/task.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/user/knob/task.c b/src/user/knob/task.c
index 598bee2..df5d38f 100644
--- a/src/user/knob/task.c
+++ b/src/user/knob/task.c
@@ -4,7 +4,7 @@
#include <knob/heap.h>
#include <knob/block.h>
-bool try_run_command(const char *path) {
+_task_handle_t run_command(const char *path) {
uint8_t dn;
path = remove_prefix(path, &dn);
@@ -22,6 +22,15 @@ bool try_run_command(const char *path) {
return _start_task(dn, path, "");
}
+bool try_run_command_blocking(const char *path) {
+ _task_handle_t handle = run_command(path);
+ if (!handle)
+ return false;
+ _wait_for_task(handle);
+ _yield_task();
+ return true;
+}
+
void yield_task() {
_yield_task();
} \ No newline at end of file