xref: /openbsd-src/gnu/llvm/libcxx/src/support/runtime/new_handler_fallback.ipp (revision 4bdff4bed0e3d54e55670334c7d0077db4170f86)
146035553Spatrick// -*- C++ -*-
246035553Spatrick//===----------------------------------------------------------------------===//
346035553Spatrick//
446035553Spatrick// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
546035553Spatrick// See https://llvm.org/LICENSE.txt for license information.
646035553Spatrick// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
746035553Spatrick//
846035553Spatrick//===----------------------------------------------------------------------===//
946035553Spatrick
1046035553Spatricknamespace std {
1146035553Spatrick
12*4bdff4beSrobertstatic constinit std::new_handler __new_handler = nullptr;
1346035553Spatrick
1446035553Spatricknew_handler
1576d0caaeSpatrickset_new_handler(new_handler handler) noexcept
1646035553Spatrick{
1746035553Spatrick    return __libcpp_atomic_exchange(&__new_handler, handler);
1846035553Spatrick}
1946035553Spatrick
2046035553Spatricknew_handler
2176d0caaeSpatrickget_new_handler() noexcept
2246035553Spatrick{
2346035553Spatrick    return __libcpp_atomic_load(&__new_handler);
2446035553Spatrick}
2546035553Spatrick
2646035553Spatrick} // namespace std
27