/
usr
/
include
/
boost
/
smart_ptr
/
detail
/
/usr/include/boost/smart_ptr/detail
mkdir
upload
Name
Size
Mode
Actions
atomic_count.hpp
3232
0644
edit
dl
rm
atomic_count_gcc.hpp
1623
0644
edit
dl
rm
atomic_count_gcc_atomic.hpp
1277
0644
edit
dl
rm
atomic_count_gcc_x86.hpp
1739
0644
edit
dl
rm
atomic_count_nt.hpp
1200
0644
edit
dl
rm
atomic_count_pt.hpp
2060
0644
edit
dl
rm
atomic_count_spin.hpp
1306
0644
edit
dl
rm
atomic_count_std_atomic.hpp
1349
0644
edit
dl
rm
atomic_count_sync.hpp
1435
0644
edit
dl
rm
atomic_count_win32.hpp
1354
0644
edit
dl
rm
lightweight_mutex.hpp
1257
0644
edit
dl
rm
lightweight_thread.hpp
3442
0644
edit
dl
rm
local_counted_base.hpp
3217
0644
edit
dl
rm
local_sp_deleter.hpp
1731
0644
edit
dl
rm
lwm_pthreads.hpp
1753
0644
edit
dl
rm
lwm_std_mutex.hpp
1077
0644
edit
dl
rm
lwm_win32_cs.hpp
2796
0644
edit
dl
rm
operator_bool.hpp
1731
0644
edit
dl
rm
quick_allocator.hpp
5137
0644
edit
dl
rm
shared_count.hpp
15367
0644
edit
dl
rm
spinlock.hpp
1863
0644
edit
dl
rm
spinlock_gcc_arm.hpp
2701
0644
edit
dl
rm
spinlock_gcc_atomic.hpp
1519
0644
edit
dl
rm
spinlock_nt.hpp
1626
0644
edit
dl
rm
spinlock_pool.hpp
2954
0644
edit
dl
rm
spinlock_pt.hpp
1474
0644
edit
dl
rm
spinlock_std_atomic.hpp
1723
0644
edit
dl
rm
spinlock_sync.hpp
1644
0644
edit
dl
rm
spinlock_w32.hpp
2104
0644
edit
dl
rm
sp_convertible.hpp
2157
0644
edit
dl
rm
sp_counted_base.hpp
3480
0644
edit
dl
rm
sp_counted_base_acc_ia64.hpp
3498
0644
edit
dl
rm
sp_counted_base_aix.hpp
3270
0644
edit
dl
rm
sp_counted_base_cw_ppc.hpp
3426
0644
edit
dl
rm
sp_counted_base_gcc_atomic.hpp
3331
0644
edit
dl
rm
sp_counted_base_gcc_ia64.hpp
4010
0644
edit
dl
rm
sp_counted_base_gcc_mips.hpp
4097
0644
edit
dl
rm
sp_counted_base_gcc_ppc.hpp
3877
0644
edit
dl
rm
sp_counted_base_gcc_sparc.hpp
3850
0644
edit
dl
rm
sp_counted_base_gcc_x86.hpp
3936
0644
edit
dl
rm
sp_counted_base_nt.hpp
2733
0644
edit
dl
rm
sp_counted_base_pt.hpp
3726
0644
edit
dl
rm
sp_counted_base_snc_ps3.hpp
3776
0644
edit
dl
rm
sp_counted_base_spin.hpp
3073
0644
edit
dl
rm
sp_counted_base_std_atomic.hpp
3557
0644
edit
dl
rm
sp_counted_base_sync.hpp
3326
0644
edit
dl
rm
sp_counted_base_vacpp_ppc.hpp
3697
0644
edit
dl
rm
sp_counted_base_w32.hpp
3264
0644
edit
dl
rm
sp_counted_impl.hpp
6808
0644
edit
dl
rm
sp_disable_deprecated.hpp
983
0644
edit
dl
rm
sp_forward.hpp
1180
0644
edit
dl
rm
sp_has_gcc_intrinsics.hpp
786
0644
edit
dl
rm
sp_has_sync_intrinsics.hpp
1872
0644
edit
dl
rm
sp_interlocked.hpp
6567
0644
edit
dl
rm
sp_noexcept.hpp
1185
0644
edit
dl
rm
sp_nullptr_t.hpp
976
0644
edit
dl
rm
sp_obsolete.hpp
914
0644
edit
dl
rm
sp_thread_pause.hpp
1101
0644
edit
dl
rm
sp_thread_sleep.hpp
2016
0644
edit
dl
rm
sp_thread_yield.hpp
1883
0644
edit
dl
rm
sp_typeinfo_.hpp
1176
0644
edit
dl
rm
sp_win32_sleep.hpp
1168
0644
edit
dl
rm
yield_k.hpp
1091
0644
edit
dl
rm
Edit:
/usr/include/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp
(4010B)
#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED #define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED // // detail/sp_counted_base_gcc_ia64.hpp - g++ on IA64 // // Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. // Copyright 2004-2006 Peter Dimov // Copyright 2005 Ben Hutchings // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // // Lock-free algorithm by Alexander Terekhov // #include <boost/smart_ptr/detail/sp_typeinfo_.hpp> #include <boost/smart_ptr/detail/sp_obsolete.hpp> #include <boost/config.hpp> #if defined(BOOST_SP_REPORT_IMPLEMENTATION) #include <boost/config/pragma_message.hpp> BOOST_PRAGMA_MESSAGE("Using g++/IA64 sp_counted_base") #endif BOOST_SP_OBSOLETE() namespace boost { namespace detail { inline void atomic_increment( int * pw ) { // ++*pw; int tmp; // No barrier is required here but fetchadd always has an acquire or // release barrier associated with it. We choose release as it should be // cheaper. __asm__ ("fetchadd4.rel %0=%1,1" : "=r"(tmp), "=m"(*pw) : "m"( *pw )); } inline int atomic_decrement( int * pw ) { // return --*pw; int rv; __asm__ (" fetchadd4.rel %0=%1,-1 ;; \n" " cmp.eq p7,p0=1,%0 ;; \n" "(p7) ld4.acq %0=%1 " : "=&r"(rv), "=m"(*pw) : "m"( *pw ) : "p7"); return rv; } inline int atomic_conditional_increment( int * pw ) { // if( *pw != 0 ) ++*pw; // return *pw; int rv, tmp, tmp2; __asm__ ("0: ld4 %0=%3 ;; \n" " cmp.eq p7,p0=0,%0 ;; \n" "(p7) br.cond.spnt 1f \n" " mov ar.ccv=%0 \n" " add %1=1,%0 ;; \n" " cmpxchg4.acq %2=%3,%1,ar.ccv ;; \n" " cmp.ne p7,p0=%0,%2 ;; \n" "(p7) br.cond.spnt 0b \n" " mov %0=%1 ;; \n" "1:" : "=&r"(rv), "=&r"(tmp), "=&r"(tmp2), "=m"(*pw) : "m"( *pw ) : "ar.ccv", "p7"); return rv; } class BOOST_SYMBOL_VISIBLE sp_counted_base { private: sp_counted_base( sp_counted_base const & ); sp_counted_base & operator= ( sp_counted_base const & ); int use_count_; // #shared int weak_count_; // #weak + (#shared != 0) public: sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) { } virtual ~sp_counted_base() // nothrow { } // dispose() is called when use_count_ drops to zero, to release // the resources managed by *this. virtual void dispose() = 0; // nothrow // destroy() is called when weak_count_ drops to zero. virtual void destroy() // nothrow { delete this; } virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() { atomic_increment( &use_count_ ); } bool add_ref_lock() // true on success { return atomic_conditional_increment( &use_count_ ) != 0; } void release() // nothrow { if( atomic_decrement( &use_count_ ) == 0 ) { dispose(); weak_release(); } } void weak_add_ref() // nothrow { atomic_increment( &weak_count_ ); } void weak_release() // nothrow { if( atomic_decrement( &weak_count_ ) == 0 ) { destroy(); } } long use_count() const // nothrow { return static_cast<int const volatile &>( use_count_ ); // TODO use ld.acq here } }; } // namespace detail } // namespace boost #endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED
Save
cmd:
run