From 3bfb3859c128f6843175ce284fcaad1bc3ec5bb8 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Tue, 30 Jun 2020 20:05:13 -0400 Subject: [PATCH] docs: Improved description of context switch --- runtime/src/worker_thread.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/src/worker_thread.c b/runtime/src/worker_thread.c index 9d93371..73ce16e 100644 --- a/runtime/src/worker_thread.c +++ b/runtime/src/worker_thread.c @@ -144,8 +144,9 @@ worker_thread_process_io(void) } /** - * Sends the current thread a SIGUSR1, causing a preempted sandbox to be restored - * Invoked by asm during a context switch + * We need to switch back to a previously preempted thread. The only way to restore all of its registers is to use + * sigreturn. To get to sigreturn, we need to send ourselves a signal, then update the registers we should return to, + * then sigreturn (by returning from the handler). */ void __attribute__((noinline)) __attribute__((noreturn)) worker_thread_sandbox_switch_preempt(void) {