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