X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=cds%2Fos%2Falloc_aligned.h;h=0be7b7226384bbabf01a22b4ffb93afb66c262b3;hb=8abb8f5e76bd8d723aff8078934ee30e59fa117a;hp=aa12313eca5775d170e75abc15854f08516ea268;hpb=c34b46ba50daf781053c4cf6e517d94188c802ed;p=libcds.git diff --git a/cds/os/alloc_aligned.h b/cds/os/alloc_aligned.h index aa12313e..0be7b722 100644 --- a/cds/os/alloc_aligned.h +++ b/cds/os/alloc_aligned.h @@ -1,4 +1,32 @@ -//$$CDS-header$$ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ #ifndef CDSLIB_OS_ALLOC_ALIGNED_H #define CDSLIB_OS_ALLOC_ALIGNED_H @@ -26,6 +54,7 @@ #include #include #include +#include namespace cds { /// OS specific wrappers @@ -105,16 +134,16 @@ namespace cds { } // construct default allocator (do nothing) - aligned_allocator() throw() + aligned_allocator() CDS_NOEXCEPT {} /// construct by copying (do nothing) - aligned_allocator(const aligned_allocator&) throw() + aligned_allocator(const aligned_allocator&) CDS_NOEXCEPT {} /// construct from a related allocator (do nothing) template - aligned_allocator(const aligned_allocator&) throw() + aligned_allocator(const aligned_allocator&) CDS_NOEXCEPT {} /// assign from a related allocator (do nothing) @@ -146,10 +175,10 @@ namespace cds { */ pointer allocate( size_type nAlign, size_type nCount ) { - assert( cds::beans::is_power2( nAlign ) ); - pointer p = reinterpret_cast( cds::OS::aligned_malloc( sizeof(T) * nCount, nAlign ) ); + assert( cds::beans::is_power2( nAlign )); + pointer p = reinterpret_cast( cds::OS::aligned_malloc( sizeof(T) * nCount, nAlign )); if ( !p ) - throw std::bad_alloc(); + CDS_THROW_EXCEPTION( std::bad_alloc()); assert( cds::details::is_aligned( p, nAlign )); return p; } @@ -163,7 +192,7 @@ namespace cds { */ pointer allocate(size_type nAlign, size_type nCount, const void *) { - return ( allocate( nAlign, nCount ) ); + return ( allocate( nAlign, nCount )); } /// construct object at \p ptr with value \p val @@ -181,7 +210,7 @@ namespace cds { } /// estimate maximum array size - size_type max_size() const throw() + size_type max_size() const CDS_NOEXCEPT { prototype a; return a.max_size();