• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4//                     The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10
11namespace std {
12
13_LIBCPP_SAFE_STATIC static std::new_handler __new_handler;
14
15new_handler
16set_new_handler(new_handler handler) _NOEXCEPT
17{
18    return __sync_lock_test_and_set(&__new_handler, handler);
19}
20
21new_handler
22get_new_handler() _NOEXCEPT
23{
24    return __sync_fetch_and_add(&__new_handler, nullptr);
25}
26
27} // namespace std
28