aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp/libcxxmsvc/src/support/win32/new_win32.cpp
blob: 00eff4abf9d251300fe3c4ff50606195b96183ad (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <atomic>
#include <new>

namespace std {

void
__throw_bad_alloc()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
    throw bad_alloc();
#endif
}

static std::atomic<std::new_handler> __new_handler;

new_handler
set_new_handler(new_handler handler) _NOEXCEPT
{
    return __new_handler.exchange(handler);
}

new_handler
get_new_handler() _NOEXCEPT
{
    return __new_handler.load();
}

}