From 43719b5fd1ae565885ac4a1ea7eca522d29a7c15 Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Tue, 28 Jan 2020 18:42:12 +0100 Subject: [PATCH] libc: fix returned timeout-left value If the suspend method for the main thread detects that the suspend condition is false it must return the passed timeout value (not always 0). Otherwise, the caller may incorrectly assume the timeout expired. --- repos/libports/src/lib/libc/internal/kernel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repos/libports/src/lib/libc/internal/kernel.h b/repos/libports/src/lib/libc/internal/kernel.h index e140a1b11..e9b07c9d2 100644 --- a/repos/libports/src/lib/libc/internal/kernel.h +++ b/repos/libports/src/lib/libc/internal/kernel.h @@ -291,7 +291,7 @@ struct Libc::Kernel final : Vfs::Io_response_handler, } if (!check.suspend() && !_kernel_routine) - return 0; + return timeout_ms; if (timeout_ms > 0) _main_timeout.timeout(timeout_ms);