Merge branch 'ldionne-ldionne-cmake' into dev
[libcds.git] / cds / threading / details / pthread_manager.h
index 16090f97093525c6851517ed4d8857a3c401b47c..be5f5d1977a7cf075c437a0f21b3e37aced303d2 100644 (file)
@@ -1,7 +1,7 @@
 /*
     This file is a part of libcds - Concurrent Data Structures library
 
-    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+    (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/
@@ -35,6 +35,7 @@
 #include <stdio.h>
 #include <pthread.h>
 #include <cds/threading/details/_common.h>
+#include <cds/details/throw_exception.h>
 
 //@cond
 namespace cds { namespace threading {
@@ -77,20 +78,20 @@ namespace cds { namespace threading {
                 static void init()
                 {
                     pthread_error_code  nErr;
-                    if ( (nErr = pthread_key_create( &m_key, key_destructor )) != 0 )
-                        throw pthread_exception( nErr, "pthread_key_create" );
+                    if ( ( nErr = pthread_key_create( &m_key, key_destructor )) != 0 )
+                        CDS_THROW_EXCEPTION( pthread_exception( nErr, "pthread_key_create" ));
                 }
 
                 static void fini()
                 {
                     pthread_error_code  nErr;
-                    if ( (nErr = pthread_key_delete( m_key )) != 0 )
-                        throw pthread_exception( nErr, "pthread_key_delete" );
+                    if ( ( nErr = pthread_key_delete( m_key )) != 0 )
+                        CDS_THROW_EXCEPTION( pthread_exception( nErr, "pthread_key_delete" ));
                 }
 
                 static ThreadData *    get()
                 {
-                    return reinterpret_cast<ThreadData *>( pthread_getspecific( m_key ) );
+                    return reinterpret_cast<ThreadData *>( pthread_getspecific( m_key ));
                 }
 
                 static void alloc()
@@ -98,7 +99,7 @@ namespace cds { namespace threading {
                     pthread_error_code  nErr;
                     ThreadData * pData = new ThreadData;
                     if ( ( nErr = pthread_setspecific( m_key, pData )) != 0 )
-                        throw pthread_exception( nErr, "pthread_setspecific" );
+                        CDS_THROW_EXCEPTION( pthread_exception( nErr, "pthread_setspecific" ));
                 }
                 static void free()
                 {
@@ -188,7 +189,7 @@ namespace cds { namespace threading {
                     pData->init();
                 }
                 else
-                    throw pthread_exception( -1, "cds::threading::pthread::Manager::attachThread" );
+                    CDS_THROW_EXCEPTION( pthread_exception( -1, "cds::threading::pthread::Manager::attachThread" ));
             }
 
             /// This method must be called in end of thread execution
@@ -204,11 +205,11 @@ namespace cds { namespace threading {
                 assert( pData );
 
                 if ( pData ) {
-                    if ( pData->fini() )
+                    if ( pData->fini())
                         _threadData( do_detachThread );
                 }
                 else
-                    throw pthread_exception( -1, "cds::threading::pthread::Manager::detachThread" );
+                    CDS_THROW_EXCEPTION( pthread_exception( -1, "cds::threading::pthread::Manager::detachThread" ));
             }
 
             /// Returns ThreadData pointer for the current thread
@@ -217,28 +218,6 @@ namespace cds { namespace threading {
                 return _threadData( do_getData );
             }
 
-            /// Get gc::HP thread GC implementation for current thread
-            /**
-                The object returned may be uninitialized if you did not call attachThread in the beginning of thread execution
-                or if you did not use gc::HP.
-                To initialize gc::HP GC you must constuct cds::gc::HP object in the beginning of your application
-            */
-            static gc::HP::thread_gc_impl&   getHZPGC()
-            {
-                return *(_threadData( do_getData )->m_hpManager);
-            }
-
-            /// Get gc::DHP thread GC implementation for current thread
-            /**
-                The object returned may be uninitialized if you did not call attachThread in the beginning of thread execution
-                or if you did not use gc::DHP.
-                To initialize gc::DHP GC you must constuct cds::gc::DHP object in the beginning of your application
-            */
-            static gc::DHP::thread_gc_impl&   getDHPGC()
-            {
-                return *(_threadData( do_getData )->m_dhpManager);
-            }
-
             //@cond
             static size_t fake_current_processor()
             {