From b4fe9a537eb10a1b3997c2b37c0483c965a3c8d7 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Mon, 6 Jul 2020 12:22:05 -0400 Subject: [PATCH] refactor: cleanup wakeup sandbox logic --- runtime/src/worker_thread.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/runtime/src/worker_thread.c b/runtime/src/worker_thread.c index cc19d31..8e48458 100644 --- a/runtime/src/worker_thread.c +++ b/runtime/src/worker_thread.c @@ -83,12 +83,13 @@ void worker_thread_wakeup_sandbox(sandbox_t *sandbox) { software_interrupt_disable(); - // debuglog("[%p: %s]\n", sandbox, sandbox->module->name); - if (sandbox->state == BLOCKED) { - sandbox->state = RUNNABLE; - debuglog("Marking blocked sandbox as runnable\n"); - local_runqueue_add(sandbox); - } + if (sandbox->state != BLOCKED) goto done; + + sandbox->state = RUNNABLE; + debuglog("Marking blocked sandbox as runnable\n"); + local_runqueue_add(sandbox); + +done: software_interrupt_enable(); }