diff options
author | Benji Dial <benji6283@gmail.com> | 2021-02-16 20:38:53 -0500 |
---|---|---|
committer | Benji Dial <benji6283@gmail.com> | 2021-02-16 20:38:53 -0500 |
commit | 47513bd32c256c4f35e3a8ced7d9fd7e15903530 (patch) | |
tree | cafdf75d52a954814726e07445063c41bb6599f9 /src/user/knob/task.c | |
parent | bd7facc4b5f53481dc85a15ba123361b2758655b (diff) | |
download | portland-os-47513bd32c256c4f35e3a8ced7d9fd7e15903530.tar.gz |
terminal application with ipc, shift+pause state dumper, hello world for terminal, meminfo popup program
Diffstat (limited to 'src/user/knob/task.c')
-rw-r--r-- | src/user/knob/task.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/user/knob/task.c b/src/user/knob/task.c index 3bf3e85..9a49386 100644 --- a/src/user/knob/task.c +++ b/src/user/knob/task.c @@ -1,9 +1,12 @@ -#include <stdbool.h> #include <pland/syscall.h> #include <knob/file.h> #include <knob/heap.h> #include <knob/block.h> +#include <stdbool.h> + +#include <knob/format.h> + _task_handle_t run_command(const char *path, _task_handle_t stdio_task) { uint8_t dn; path = remove_prefix(path, &dn); @@ -14,9 +17,9 @@ _task_handle_t run_command(const char *path, _task_handle_t stdio_task) { blockcpy(new_path, path, ptr - path); new_path[ptr - path] = '\0'; - bool succeded = _start_task(dn, new_path, ptr + 1, stdio_task); + _task_handle_t handle = _start_task(dn, new_path, ptr + 1, stdio_task); free_block(new_path); - return succeded; + return handle; } return _start_task(dn, path, "", stdio_task); @@ -24,11 +27,12 @@ _task_handle_t run_command(const char *path, _task_handle_t stdio_task) { bool try_run_command_blocking(const char *path, _task_handle_t stdio_task) { _task_handle_t handle = run_command(path, stdio_task); - if (!handle) + if (!handle) { return false; - while (_is_task_running(handle)) { + } + do { _wait_for_task(handle); _yield_task(); - } + } while (_is_task_running(handle)); return true; }
\ No newline at end of file |