summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls/futex.cpp
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2020-12-07 21:29:41 -0700
committerAndreas Kling <kling@serenityos.org>2020-12-12 21:28:12 +0100
commitda5cc34ebbdfcc5b37815d369fe0c0931df54c90 (patch)
tree21b1bf721a5dce58a0ea652cee8d05d74884f002 /Kernel/Syscalls/futex.cpp
parent0918d8b1f8bae11a2ef97c79564a7e7c9a394eb5 (diff)
downloadserenity-da5cc34ebbdfcc5b37815d369fe0c0931df54c90.zip
Kernel: Fix some issues related to fixes and block conditions
Fix some problems with join blocks where the joining thread block condition was added twice, which lead to a crash when trying to unblock that condition a second time. Deferred block condition evaluation by File objects were also not properly keeping the File object alive, which lead to some random crashes and corruption problems. Other problems were caused by the fact that the Queued state didn't handle signals/interruptions consistently. To solve these issues we remove this state entirely, along with Thread::wait_on and change the WaitQueue into a BlockCondition instead. Also, deliver signals even if there isn't going to be a context switch to another thread. Fixes #4336 and #4330
Diffstat (limited to 'Kernel/Syscalls/futex.cpp')
-rw-r--r--Kernel/Syscalls/futex.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/Kernel/Syscalls/futex.cpp b/Kernel/Syscalls/futex.cpp
index 10771bf81c..0cdb2b61be 100644
--- a/Kernel/Syscalls/futex.cpp
+++ b/Kernel/Syscalls/futex.cpp
@@ -61,9 +61,8 @@ int Process::sys$futex(Userspace<const Syscall::SC_futex_params*> user_params)
timeout = Thread::BlockTimeout(true, &ts_abstimeout);
}
- // FIXME: This is supposed to be interruptible by a signal, but right now WaitQueue cannot be interrupted.
WaitQueue& wait_queue = futex_queue((FlatPtr)params.userspace_address);
- Thread::BlockResult result = Thread::current()->wait_on(wait_queue, "Futex", timeout);
+ Thread::BlockResult result = wait_queue.wait_on(timeout, "Futex");
if (result == Thread::BlockResult::InterruptedByTimeout) {
return -ETIMEDOUT;
}