[urcu] Moved signal handler implementation to .cpp file
authorkhizmax <libcds.dev@gmail.com>
Thu, 23 Feb 2017 08:23:10 +0000 (11:23 +0300)
committerkhizmax <libcds.dev@gmail.com>
Thu, 23 Feb 2017 08:23:10 +0000 (11:23 +0300)
cds/threading/details/_common.h
cds/urcu/details/sh.h
cds/urcu/details/sh_decl.h
src/urcu_sh.cpp

index 69b73f1..f8f0599 100644 (file)
@@ -141,9 +141,6 @@ namespace cds {
 
             //@endcond
 
-            //cds::gc::HP::thread_gc_impl  * m_hpManager     ;   ///< Michael's Hazard Pointer GC thread-specific data
-            //cds::gc::DHP::thread_gc_impl * m_dhpManager    ;   ///< Dynamic Hazard Pointer GC thread-specific data
-
             size_t  m_nFakeProcessorNumber  ;   ///< fake "current processor" number
 
             //@cond
index 682c3ee..6de2b70 100644 (file)
@@ -111,7 +111,6 @@ namespace cds { namespace urcu { namespace details {
         sigact.sa_sigaction = signal_handler;
         sigact.sa_flags = SA_SIGINFO;
         sigemptyset( &sigact.sa_mask );
-        //sigaddset( &sigact.sa_mask, m_nSigNo );
         sigaction( m_nSigNo, &sigact, nullptr );
 
         sigaddset( &sigact.sa_mask, m_nSigNo );
@@ -122,17 +121,6 @@ namespace cds { namespace urcu { namespace details {
     inline void sh_singleton<RCUtag>::clear_signal_handler()
     {}
 
-    template <typename RCUtag>
-    void sh_singleton<RCUtag>::signal_handler( int /*signo*/, siginfo_t * /*sigInfo*/, void * /*context*/ )
-    {
-        thread_record * pRec = cds::threading::getRCU<RCUtag>();
-        if ( pRec ) {
-            atomics::atomic_signal_fence( atomics::memory_order_acquire );
-            pRec->m_bNeedMemBar.store( false, atomics::memory_order_relaxed );
-            atomics::atomic_signal_fence( atomics::memory_order_release );
-        }
-    }
-
     template <typename RCUtag>
     inline void sh_singleton<RCUtag>::raise_signal( cds::OS::ThreadId tid )
     {
index 0c54e77..f0fe6ad 100644 (file)
@@ -85,6 +85,7 @@ namespace cds { namespace urcu { namespace details {
     public:
         sh_thread_gc();
         ~sh_thread_gc();
+
     public:
         static void access_lock();
         static void access_unlock();
@@ -132,9 +133,9 @@ namespace cds { namespace urcu { namespace details {
         typedef sh_singleton_instance< rcu_tag >    rcu_instance;
 
     protected:
-        atomics::atomic<uint32_t>    m_nGlobalControl;
-        thread_list< rcu_tag >          m_ThreadList;
-        int const                       m_nSigNo;
+        atomics::atomic<uint32_t>   m_nGlobalControl;
+        thread_list< rcu_tag >      m_ThreadList;
+        int const                   m_nSigNo;
 
     protected:
         sh_singleton( int nSignal )
index 368008f..ddd919d 100644 (file)
@@ -36,6 +36,29 @@ namespace cds { namespace urcu { namespace details {
     template<> CDS_EXPORT_API singleton_vtbl * sh_singleton_instance< signal_buffered_tag >::s_pRCU = nullptr;
     template<> CDS_EXPORT_API singleton_vtbl * sh_singleton_instance< signal_threaded_tag >::s_pRCU = nullptr;
 
+    template <>
+    void sh_singleton<signal_buffered_tag>::signal_handler( int /*signo*/, siginfo_t * /*sigInfo*/, void * /*context*/ )
+    {
+        thread_record * pRec = cds::threading::getRCU<signal_buffered_tag>();
+        if ( pRec ) {
+            atomics::atomic_signal_fence( atomics::memory_order_acquire );
+            pRec->m_bNeedMemBar.store( false, atomics::memory_order_relaxed );
+            atomics::atomic_signal_fence( atomics::memory_order_release );
+        }
+    }
+
+    template <>
+    void sh_singleton<signal_threaded_tag>::signal_handler( int /*signo*/, siginfo_t * /*sigInfo*/, void * /*context*/ )
+    {
+        thread_record * pRec = cds::threading::getRCU<signal_threaded_tag>();
+        if ( pRec ) {
+            atomics::atomic_signal_fence( atomics::memory_order_acquire );
+            pRec->m_bNeedMemBar.store( false, atomics::memory_order_relaxed );
+            atomics::atomic_signal_fence( atomics::memory_order_release );
+        }
+    }
+
+
 }}} // namespace cds::urcu::details
 
 #endif //#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED