mirror of
https://github.com/boostorg/thread.git
synced 2026-02-18 02:22:10 +00:00
Throw if malloc fails.
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include <boost/thread/pthread/pthread_mutex_scoped_lock.hpp>
|
||||
#include <boost/thread/once.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory>
|
||||
@@ -67,6 +68,7 @@ namespace boost
|
||||
if(!data)
|
||||
{
|
||||
data=malloc(sizeof(thread_detail::uintmax_atomic_t));
|
||||
if(!data) BOOST_THROW_EXCEPTION(std::bad_alloc());
|
||||
BOOST_VERIFY(!pthread_setspecific(epoch_tss_key,data));
|
||||
*static_cast<thread_detail::uintmax_atomic_t*>(data)=BOOST_THREAD_DETAIL_UINTMAX_ATOMIC_MAX_C;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user