mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 18:20:43 +09:00
LibC: Mark a bunch of functions as cancellation points
This commit is contained in:
parent
899fd74f8e
commit
c85f307e62
Notes:
sideshowbarker
2024-07-17 08:39:41 +09:00
Author: https://github.com/timschumi
Commit: c85f307e62
Pull-request: https://github.com/SerenityOS/serenity/pull/14629
Reviewed-by: https://github.com/bgianfo
15 changed files with 78 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <AK/Format.h>
|
||||
#include <assert.h>
|
||||
#include <bits/pthread_cancel.h>
|
||||
#include <errno.h>
|
||||
#include <setjmp.h>
|
||||
#include <signal.h>
|
||||
|
@ -175,6 +176,8 @@ void siglongjmp(jmp_buf env, int val)
|
|||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigsuspend.html
|
||||
int sigsuspend(sigset_t const* set)
|
||||
{
|
||||
__pthread_maybe_cancel();
|
||||
|
||||
int rc = syscall(SC_sigsuspend, set);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
@ -182,6 +185,8 @@ int sigsuspend(sigset_t const* set)
|
|||
// https://pubs.opengroup.org/onlinepubs/009604499/functions/sigwait.html
|
||||
int sigwait(sigset_t const* set, int* sig)
|
||||
{
|
||||
__pthread_maybe_cancel();
|
||||
|
||||
int rc = syscall(Syscall::SC_sigtimedwait, set, nullptr, nullptr);
|
||||
VERIFY(rc != 0);
|
||||
if (rc < 0)
|
||||
|
@ -199,6 +204,8 @@ int sigwaitinfo(sigset_t const* set, siginfo_t* info)
|
|||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigtimedwait.html
|
||||
int sigtimedwait(sigset_t const* set, siginfo_t* info, struct timespec const* timeout)
|
||||
{
|
||||
__pthread_maybe_cancel();
|
||||
|
||||
int rc = syscall(Syscall::SC_sigtimedwait, set, info, timeout);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue