[flang] Use object before converts in fir.dispatch (#68589)
[llvm-project.git] / libc / src / stdlib / linux / abort.cpp
blob59feec3e5a06df3aaf11a1ae8be8ae40856080cd
1 //===-- Implementation of abort -------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "src/__support/common.h"
10 #include "src/signal/raise.h"
11 #include "src/stdlib/_Exit.h"
13 #include "src/stdlib/abort.h"
15 namespace LIBC_NAMESPACE {
17 LLVM_LIBC_FUNCTION(void, abort, ()) {
18 // TODO: When sigprocmask and sigaction land:
19 // Unblock SIGABRT, raise it, if it was ignored or the handler returned,
20 // change its action to SIG_DFL, raise it again.
21 // TODO: When C11 mutexes land:
22 // Acquire recursive mutex (in case the current signal handler for SIGABRT
23 // itself calls abort we don't want to deadlock on the same thread trying
24 // to acquire it's own mutex.)
25 LIBC_NAMESPACE::raise(SIGABRT);
26 LIBC_NAMESPACE::raise(SIGKILL);
27 LIBC_NAMESPACE::_Exit(127);
30 } // namespace LIBC_NAMESPACE