Uses different pass count for different parallel queue test cases
[libcds.git] / cds / os / alloc_aligned.h
index aa12313eca5775d170e75abc15854f08516ea268..0be7b7226384bbabf01a22b4ffb93afb66c262b3 100644 (file)
@@ -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 <memory>
 #include <cds/details/is_aligned.h>
 #include <cds/algo/int_algo.h>
+#include <cds/details/throw_exception.h>
 
 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<T>&) throw()
+            aligned_allocator(const aligned_allocator<T>&) CDS_NOEXCEPT
             {}
 
             /// construct from a related allocator (do nothing)
             template <class OTHER>
-            aligned_allocator(const aligned_allocator<OTHER>&) throw()
+            aligned_allocator(const aligned_allocator<OTHER>&) 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<T *>( cds::OS::aligned_malloc( sizeof(T) * nCount, nAlign ) );
+                assert( cds::beans::is_power2( nAlign ));
+                pointer p = reinterpret_cast<T *>( 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();