| |||
| Home > The ARM C and C++ libraries > Thread safety in the ARM C++ library | |||
The following summarizes thread safety in the C++ library:
The function std::set_new_handler() is
not thread-safe. This means that some forms of ::operator
new and ::operator delete are
not thread-safe with respect to std::set_new_handler():
The default C++ runtime library implementations
of the following use malloc() and free() and
are thread-safe with respect to each other. They are not thread-safe
with respect to std::set_new_handler(). You
are permitted to replace them:
::operator new(std::size_t)
::operator new[](std::size_t)
::operator new(std::size_t, const std::nothrow_t&)
::operator new[](std::size_t, const std::nothrow_t)
::operator delete(void*)
::operator delete[](void*)
::operator delete(void*, const std::nothrow_t&)
::operator delete[](void*, const std::nothrow_t&)
The following placement forms are also thread-safe. You are not permitted to replace them:
::operator new(std::size_t, void*)
::operator new[](std::size_t, void*)
::operator delete(void*, void*)
::operator delete[](void*, void*)
Construction and destruction of global objects is not thread-safe.
Construction of local static objects can be made
thread-safe if you re-implement the functions __cxa_guard_acquire(), __cxa_guard_release(), __cxa_guard_abort(), __cxa_atexit() and __aeabi_atexit() appropriately.
For example, with appropriate re-implementation, the following construction
of lsobj can be made thread-safe:
struct T { T(); };
void f() { static T lsobj; }
Throwing an exception is thread-safe if any user constructors and destructors that get called are also thread-safe.
The ARM C++ library uses the ARM C library. To use the ARM C++ library in a multithreaded environment, you must provide the same functions that you would be required to provide when using the ARM C library in a multithreaded environment.
__cxa_, *__aeabi_ functions, C++
ABI for the ARM® Architecture*