X-Git-Url: http://plrg.eecs.uci.edu/git/?p=libcds.git;a=blobdiff_plain;f=src%2Furcu_sh.cpp;h=d7568c7a1abc586cb59a22d7f85d554643949b64;hp=d450a6b679aafd1911122efa520c52a83c824e68;hb=HEAD;hpb=98aa954aa9d1b640f6f6d81018542eec1c2046bb diff --git a/src/urcu_sh.cpp b/src/urcu_sh.cpp index d450a6b6..d7568c7a 100644 --- a/src/urcu_sh.cpp +++ b/src/urcu_sh.cpp @@ -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. +*/ #include @@ -6,7 +34,17 @@ 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_handler( int /*signo*/, siginfo_t * /*sigInfo*/, void * /*context*/ ) + { + thread_record * pRec = cds::threading::getRCU(); + 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