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 11 namespace std { 12 13 _LIBCPP_SAFE_STATIC static std::new_handler __new_handler; 14 15 new_handler 16 set_new_handler(new_handler handler) _NOEXCEPT 17 { 18 return __sync_lock_test_and_set(&__new_handler, handler); 19 } 20 21 new_handler 22 get_new_handler() _NOEXCEPT 23 { 24 return __sync_fetch_and_add(&__new_handler, nullptr); 25 } 26 27 } // namespace std 28