2
0
mirror of https://github.com/boostorg/log.git synced 2026-02-03 09:12:19 +00:00

Use Boost.Align for aligned allocation

This commit is contained in:
Glen Fernandes
2014-05-03 19:17:07 -07:00
parent 20ceaf4fd5
commit 368194af72
4 changed files with 11 additions and 140 deletions

View File

@@ -28,10 +28,10 @@
#include <new>
#include <boost/assert.hpp>
#include <boost/throw_exception.hpp>
#include <boost/align/aligned_alloc.hpp>
#include <boost/type_traits/alignment_of.hpp>
#include <boost/log/detail/spin_mutex.hpp>
#include <boost/log/detail/locks.hpp>
#include <boost/log/detail/malloc_aligned.hpp>
#include <boost/log/detail/header.hpp>
namespace boost {
@@ -137,7 +137,7 @@ BOOST_LOG_API threadsafe_queue_impl* threadsafe_queue_impl::create(node_base* fi
BOOST_LOG_API void* threadsafe_queue_impl::operator new (std::size_t size)
{
void* p = malloc_aligned(size, BOOST_LOG_CPU_CACHE_LINE_SIZE);
void* p = alignment::aligned_alloc(BOOST_LOG_CPU_CACHE_LINE_SIZE, size);
if (!p)
BOOST_THROW_EXCEPTION(std::bad_alloc());
return p;
@@ -145,7 +145,7 @@ BOOST_LOG_API void* threadsafe_queue_impl::operator new (std::size_t size)
BOOST_LOG_API void threadsafe_queue_impl::operator delete (void* p, std::size_t)
{
free_aligned(p);
alignment::aligned_free(p);
}
} // namespace aux