xref: /llvm-project/libc/src/stdlib/gpu/abort.cpp (revision 3f30effe1bd81fa1b039218a9bfe79c3b03fafad)
1 //===-- GPU 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 //===----------------------------------------------------------------------===//
8 
9 #include "src/__support/RPC/rpc_client.h"
10 #include "src/__support/common.h"
11 #include "src/__support/macros/config.h"
12 
13 #include "src/stdlib/abort.h"
14 
15 namespace LIBC_NAMESPACE_DECL {
16 
17 LLVM_LIBC_FUNCTION(void, abort, ()) {
18   // We want to first make sure the server is listening before we abort.
19   rpc::Client::Port port = rpc::client.open<RPC_ABORT>();
20   port.send_and_recv([](rpc::Buffer *) {}, [](rpc::Buffer *) {});
21   port.send([&](rpc::Buffer *) {});
22   port.close();
23 
24   gpu::end_program();
25 }
26 
27 } // namespace LIBC_NAMESPACE_DECL
28