|
Boost-Commit : |
From: pdimov_at_[hidden]
Date: 2008-07-12 05:55:10
Author: pdimov
Date: 2008-07-12 05:55:08 EDT (Sat, 12 Jul 2008)
New Revision: 47339
URL: http://svn.boost.org/trac/boost/changeset/47339
Log:
Merged 43316, 43317, 43318, 43733, 43782, 43873, 43888, 43916, 43950, 44055, 44056, 44058, 44073, 44074, 44132, 44137, 44138, 44140, 44344 from trunk to release
Added:
branches/release/boost/detail/sp_counted_base_spin.hpp
- copied unchanged from r44138, /trunk/boost/detail/sp_counted_base_spin.hpp
branches/release/boost/detail/spinlock.hpp
- copied, changed from r43950, /trunk/boost/detail/spinlock.hpp
branches/release/boost/detail/spinlock_gcc_arm.hpp
- copied, changed from r44138, /trunk/boost/detail/spinlock_gcc_arm.hpp
branches/release/boost/detail/spinlock_nt.hpp
- copied, changed from r44056, /trunk/boost/detail/spinlock_nt.hpp
branches/release/boost/detail/spinlock_pool.hpp
- copied, changed from r44074, /trunk/boost/detail/spinlock_pool.hpp
branches/release/boost/detail/spinlock_pt.hpp
- copied unchanged from r43950, /trunk/boost/detail/spinlock_pt.hpp
branches/release/boost/detail/spinlock_sync.hpp
- copied unchanged from r43950, /trunk/boost/detail/spinlock_sync.hpp
branches/release/boost/detail/spinlock_w32.hpp
- copied, changed from r43950, /trunk/boost/detail/spinlock_w32.hpp
branches/release/boost/detail/yield_k.hpp
- copied, changed from r43888, /trunk/boost/detail/yield_k.hpp
branches/release/libs/smart_ptr/test/esft_regtest.cpp
- copied unchanged from r43733, /trunk/libs/smart_ptr/test/esft_regtest.cpp
branches/release/libs/smart_ptr/test/scoped_array_eq_fail.cpp
- copied unchanged from r43318, /trunk/libs/smart_ptr/test/scoped_array_eq_fail.cpp
branches/release/libs/smart_ptr/test/scoped_ptr_eq_fail.cpp
- copied unchanged from r43318, /trunk/libs/smart_ptr/test/scoped_ptr_eq_fail.cpp
branches/release/libs/smart_ptr/test/spinlock_pool_test.cpp
- copied unchanged from r44074, /trunk/libs/smart_ptr/test/spinlock_pool_test.cpp
branches/release/libs/smart_ptr/test/spinlock_test.cpp
- copied, changed from r43950, /trunk/libs/smart_ptr/test/spinlock_test.cpp
branches/release/libs/smart_ptr/test/spinlock_try_test.cpp
- copied unchanged from r44056, /trunk/libs/smart_ptr/test/spinlock_try_test.cpp
branches/release/libs/smart_ptr/test/yield_k_test.cpp
- copied unchanged from r43888, /trunk/libs/smart_ptr/test/yield_k_test.cpp
Text files modified:
branches/release/boost/detail/interlocked.hpp | 2 +-
branches/release/boost/detail/shared_count.hpp | 19 +++++++++++++++++++
branches/release/boost/detail/sp_counted_base.hpp | 4 ++++
branches/release/boost/detail/spinlock.hpp | 8 ++++++--
branches/release/boost/detail/spinlock_gcc_arm.hpp | 2 +-
branches/release/boost/detail/spinlock_nt.hpp | 28 +++++++++++++++++++++++++---
branches/release/boost/detail/spinlock_pool.hpp | 4 ++--
branches/release/boost/detail/spinlock_w32.hpp | 35 +++++++++++++++++++++++++----------
branches/release/boost/detail/yield_k.hpp | 35 ++++++++++++++++++++++++-----------
branches/release/boost/scoped_array.hpp | 3 +++
branches/release/boost/scoped_ptr.hpp | 3 +++
branches/release/boost/shared_ptr.hpp | 20 ++++++++++++++++++++
branches/release/boost/weak_ptr.hpp | 26 +-------------------------
branches/release/libs/smart_ptr/shared_ptr.htm | 11 ++++++-----
branches/release/libs/smart_ptr/test/Jamfile.v2 | 9 +++++++++
branches/release/libs/smart_ptr/test/shared_from_this_test.cpp | 3 ++-
branches/release/libs/smart_ptr/test/shared_ptr_test.cpp | 12 ++++++++++++
branches/release/libs/smart_ptr/test/spinlock_test.cpp | 17 +----------------
18 files changed, 164 insertions(+), 77 deletions(-)
Modified: branches/release/boost/detail/interlocked.hpp
==============================================================================
--- branches/release/boost/detail/interlocked.hpp (original)
+++ branches/release/boost/detail/interlocked.hpp 2008-07-12 05:55:08 EDT (Sat, 12 Jul 2008)
@@ -92,7 +92,7 @@
# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange
# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd
-#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ )
+#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ )
namespace boost
{
Modified: branches/release/boost/detail/shared_count.hpp
==============================================================================
--- branches/release/boost/detail/shared_count.hpp (original)
+++ branches/release/boost/detail/shared_count.hpp 2008-07-12 05:55:08 EDT (Sat, 12 Jul 2008)
@@ -46,6 +46,8 @@
#endif
+struct sp_nothrow_tag {};
+
class weak_count;
class shared_count
@@ -216,6 +218,7 @@
}
explicit shared_count(weak_count const & r); // throws bad_weak_ptr when r.use_count() == 0
+ shared_count( weak_count const & r, sp_nothrow_tag ); // constructs an empty *this when r.use_count() == 0
shared_count & operator= (shared_count const & r) // nothrow
{
@@ -248,6 +251,11 @@
return use_count() == 1;
}
+ bool empty() const // nothrow
+ {
+ return pi_ == 0;
+ }
+
friend inline bool operator==(shared_count const & a, shared_count const & b)
{
return a.pi_ == b.pi_;
@@ -364,6 +372,17 @@
}
}
+inline shared_count::shared_count( weak_count const & r, sp_nothrow_tag ): pi_( r.pi_ )
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ , id_(shared_count_id)
+#endif
+{
+ if( pi_ != 0 && !pi_->add_ref_lock() )
+ {
+ pi_ = 0;
+ }
+}
+
} // namespace detail
} // namespace boost
Modified: branches/release/boost/detail/sp_counted_base.hpp
==============================================================================
--- branches/release/boost/detail/sp_counted_base.hpp (original)
+++ branches/release/boost/detail/sp_counted_base.hpp 2008-07-12 05:55:08 EDT (Sat, 12 Jul 2008)
@@ -23,6 +23,10 @@
# include <boost/detail/sp_counted_base_nt.hpp>
+#elif defined( BOOST_SP_USE_SPINLOCK )
+
+# include <boost/detail/sp_counted_base_spin.hpp>
+
#elif defined( BOOST_SP_USE_PTHREADS )
# include <boost/detail/sp_counted_base_pt.hpp>
Copied: branches/release/boost/detail/spinlock.hpp (from r43950, /trunk/boost/detail/spinlock.hpp)
==============================================================================
--- /trunk/boost/detail/spinlock.hpp (original)
+++ branches/release/boost/detail/spinlock.hpp 2008-07-12 05:55:08 EDT (Sat, 12 Jul 2008)
@@ -30,12 +30,16 @@
#include <boost/config.hpp>
-#if defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 )
+#if defined(__GNUC__) && defined( __arm__ )
+# include <boost/detail/spinlock_gcc_arm.hpp>
+#elif defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 )
# include <boost/detail/spinlock_sync.hpp>
-#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
+#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
# include <boost/detail/spinlock_w32.hpp>
#elif defined(BOOST_HAS_PTHREADS)
# include <boost/detail/spinlock_pt.hpp>
+#elif !defined(BOOST_HAS_THREADS)
+# include <boost/detail/spinlock_nt.hpp>
#else
# error Unrecognized threading platform
#endif
Copied: branches/release/boost/detail/spinlock_gcc_arm.hpp (from r44138, /trunk/boost/detail/spinlock_gcc_arm.hpp)
==============================================================================
--- /trunk/boost/detail/spinlock_gcc_arm.hpp (original)
+++ branches/release/boost/detail/spinlock_gcc_arm.hpp 2008-07-12 05:55:08 EDT (Sat, 12 Jul 2008)
@@ -31,7 +31,7 @@
__asm__ __volatile__(
"swp %0, %1, [%2]":
- "=r"( r ): // outputs
+ "=&r"( r ): // outputs
"r"( 1 ), "r"( &v_ ): // inputs
"memory", "cc" );
Copied: branches/release/boost/detail/spinlock_nt.hpp (from r44056, /trunk/boost/detail/spinlock_nt.hpp)
==============================================================================
--- /trunk/boost/detail/spinlock_nt.hpp (original)
+++ branches/release/boost/detail/spinlock_nt.hpp 2008-07-12 05:55:08 EDT (Sat, 12 Jul 2008)
@@ -15,6 +15,8 @@
// http://www.boost.org/LICENSE_1_0.txt)
//
+#include <boost/assert.hpp>
+
namespace boost
{
@@ -25,17 +27,33 @@
{
public:
+ bool locked_;
+
+public:
+
inline bool try_lock()
{
- return true;
+ if( locked_ )
+ {
+ return false;
+ }
+ else
+ {
+ locked_ = true;
+ return true;
+ }
}
inline void lock()
{
+ BOOST_ASSERT( !locked_ );
+ locked_ = true;
}
inline void unlock()
{
+ BOOST_ASSERT( locked_ );
+ locked_ = false;
}
public:
@@ -44,17 +62,21 @@
{
private:
+ spinlock & sp_;
+
scoped_lock( scoped_lock const & );
scoped_lock & operator=( scoped_lock const & );
public:
- explicit scoped_lock( spinlock & /*sp*/ )
+ explicit scoped_lock( spinlock & sp ): sp_( sp )
{
+ sp.lock();
}
~scoped_lock()
{
+ sp_.unlock();
}
};
};
@@ -62,6 +84,6 @@
} // namespace detail
} // namespace boost
-#define BOOST_DETAIL_SPINLOCK_INIT {}
+#define BOOST_DETAIL_SPINLOCK_INIT { false }
#endif // #ifndef BOOST_DETAIL_SPINLOCK_NT_HPP_INCLUDED
Copied: branches/release/boost/detail/spinlock_pool.hpp (from r44074, /trunk/boost/detail/spinlock_pool.hpp)
==============================================================================
--- /trunk/boost/detail/spinlock_pool.hpp (original)
+++ branches/release/boost/detail/spinlock_pool.hpp 2008-07-12 05:55:08 EDT (Sat, 12 Jul 2008)
@@ -37,7 +37,7 @@
public:
- static spinlock & spinlock_for( void * pv )
+ static spinlock & spinlock_for( void const * pv )
{
size_t i = reinterpret_cast< size_t >( pv ) % 41;
return pool_[ i ];
@@ -54,7 +54,7 @@
public:
- explicit scoped_lock( void * pv ): sp_( spinlock_for( pv ) )
+ explicit scoped_lock( void const * pv ): sp_( spinlock_for( pv ) )
{
sp_.lock();
}
Copied: branches/release/boost/detail/spinlock_w32.hpp (from r43950, /trunk/boost/detail/spinlock_w32.hpp)
==============================================================================
--- /trunk/boost/detail/spinlock_w32.hpp (original)
+++ branches/release/boost/detail/spinlock_w32.hpp 2008-07-12 05:55:08 EDT (Sat, 12 Jul 2008)
@@ -18,11 +18,31 @@
#include <boost/detail/interlocked.hpp>
#include <boost/detail/yield_k.hpp>
-#if defined( _MSC_VER ) && _MSC_VER >= 1310
- extern "C" void _ReadWriteBarrier();
-# pragma intrinsic( _ReadWriteBarrier )
+// BOOST_COMPILER_FENCE
+
+#if defined(__INTEL_COMPILER)
+
+#define BOOST_COMPILER_FENCE __memory_barrier();
+
+#elif defined( _MSC_VER ) && _MSC_VER >= 1310
+
+extern "C" void _ReadWriteBarrier();
+#pragma intrinsic( _ReadWriteBarrier )
+
+#define BOOST_COMPILER_FENCE _ReadWriteBarrier();
+
+#elif defined(__GNUC__)
+
+#define BOOST_COMPILER_FENCE __asm__ __volatile__( "" ::: "memory" );
+
+#else
+
+#define BOOST_COMPILER_FENCE
+
#endif
+//
+
namespace boost
{
@@ -41,9 +61,7 @@
{
long r = BOOST_INTERLOCKED_EXCHANGE( &v_, 1 );
-#if defined( _MSC_VER ) && _MSC_VER >= 1310
- _ReadWriteBarrier();
-#endif
+ BOOST_COMPILER_FENCE
return r == 0;
}
@@ -58,10 +76,7 @@
void unlock()
{
-#if defined( _MSC_VER ) && _MSC_VER >= 1310
- _ReadWriteBarrier();
-#endif
-
+ BOOST_COMPILER_FENCE
*const_cast< long volatile* >( &v_ ) = 0;
}
Copied: branches/release/boost/detail/yield_k.hpp (from r43888, /trunk/boost/detail/yield_k.hpp)
==============================================================================
--- /trunk/boost/detail/yield_k.hpp (original)
+++ branches/release/boost/detail/yield_k.hpp 2008-07-12 05:55:08 EDT (Sat, 12 Jul 2008)
@@ -25,14 +25,27 @@
#include <boost/config.hpp>
-#if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ )
+// BOOST_SMT_PAUSE
+
+#if defined(_MSC_VER) && _MSC_VER >= 1310 && ( defined(_M_IX86) || defined(_M_X64) )
+
+extern "C" void _mm_pause();
+#pragma intrinsic( _mm_pause )
+
+#define BOOST_SMT_PAUSE _mm_pause();
+
+#elif defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) )
+
+#define BOOST_SMT_PAUSE __asm__ __volatile__( "rep; nop" ::: "memory" );
-#if defined( BOOST_USE_WINDOWS_H )
-# include <windows.h>
#endif
-#if defined(_MSC_VER) && _MSC_VER >= 1310
- extern "C" void _mm_pause();
+//
+
+#if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ )
+
+#if defined( BOOST_USE_WINDOWS_H )
+# include <windows.h>
#endif
namespace boost
@@ -45,15 +58,15 @@
extern "C" void __stdcall Sleep( unsigned ms );
#endif
-void yield( unsigned k )
+inline void yield( unsigned k )
{
if( k < 4 )
{
}
-#if defined(_MSC_VER) && _MSC_VER >= 1310
+#if defined( BOOST_SMT_PAUSE )
else if( k < 16 )
{
- _mm_pause();
+ BOOST_SMT_PAUSE
}
#endif
else if( k < 32 )
@@ -81,15 +94,15 @@
namespace detail
{
-void yield( unsigned k )
+inline void yield( unsigned k )
{
if( k < 4 )
{
}
-#if defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) )
+#if defined( BOOST_SMT_PAUSE )
else if( k < 16 )
{
- __asm__ __volatile__( "rep; nop" ::: "memory" );
+ BOOST_SMT_PAUSE
}
#endif
else if( k < 32 || k & 1 )
Modified: branches/release/boost/scoped_array.hpp
==============================================================================
--- branches/release/boost/scoped_array.hpp (original)
+++ branches/release/boost/scoped_array.hpp 2008-07-12 05:55:08 EDT (Sat, 12 Jul 2008)
@@ -46,6 +46,9 @@
typedef scoped_array<T> this_type;
+ void operator==( scoped_array const& ) const;
+ void operator!=( scoped_array const& ) const;
+
public:
typedef T element_type;
Modified: branches/release/boost/scoped_ptr.hpp
==============================================================================
--- branches/release/boost/scoped_ptr.hpp (original)
+++ branches/release/boost/scoped_ptr.hpp 2008-07-12 05:55:08 EDT (Sat, 12 Jul 2008)
@@ -47,6 +47,9 @@
typedef scoped_ptr<T> this_type;
+ void operator==( scoped_ptr const& ) const;
+ void operator!=( scoped_ptr const& ) const;
+
public:
typedef T element_type;
Modified: branches/release/boost/shared_ptr.hpp
==============================================================================
--- branches/release/boost/shared_ptr.hpp (original)
+++ branches/release/boost/shared_ptr.hpp 2008-07-12 05:55:08 EDT (Sat, 12 Jul 2008)
@@ -31,7 +31,14 @@
#include <algorithm> // for std::swap
#include <functional> // for std::less
#include <typeinfo> // for std::bad_cast
+
+#if !defined(BOOST_NO_IOSTREAM)
+#if !defined(BOOST_NO_IOSFWD)
#include <iosfwd> // for std::basic_ostream
+#else
+#include <ostream>
+#endif
+#endif
#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash
# pragma warning(push)
@@ -208,6 +215,15 @@
}
template<class Y>
+ shared_ptr( weak_ptr<Y> const & r, boost::detail::sp_nothrow_tag ): px( 0 ), pn( r.pn, boost::detail::sp_nothrow_tag() ) // never throws
+ {
+ if( !pn.empty() )
+ {
+ px = r.px;
+ }
+ }
+
+ template<class Y>
shared_ptr(shared_ptr<Y> const & r): px(r.px), pn(r.pn) // never throws
{
}
@@ -555,6 +571,8 @@
// operator<<
+#if !defined(BOOST_NO_IOSTREAM)
+
#if defined(__GNUC__) && (__GNUC__ < 3)
template<class Y> std::ostream & operator<< (std::ostream & os, shared_ptr<Y> const & p)
@@ -584,6 +602,8 @@
#endif // __GNUC__ < 3
+#endif // !defined(BOOST_NO_IOSTREAM)
+
// get_deleter
#if ( defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3) ) || \
Modified: branches/release/boost/weak_ptr.hpp
==============================================================================
--- branches/release/boost/weak_ptr.hpp (original)
+++ branches/release/boost/weak_ptr.hpp 2008-07-12 05:55:08 EDT (Sat, 12 Jul 2008)
@@ -93,31 +93,7 @@
shared_ptr<T> lock() const // never throws
{
-#if defined(BOOST_HAS_THREADS)
-
- // optimization: avoid throw overhead
- if(expired())
- {
- return shared_ptr<element_type>();
- }
-
- try
- {
- return shared_ptr<element_type>(*this);
- }
- catch(bad_weak_ptr const &)
- {
- // Q: how can we get here?
- // A: another thread may have invalidated r after the use_count test above.
- return shared_ptr<element_type>();
- }
-
-#else
-
- // optimization: avoid try/catch overhead when single threaded
- return expired()? shared_ptr<element_type>(): shared_ptr<element_type>(*this);
-
-#endif
+ return shared_ptr<element_type>( *this, boost::detail::sp_nothrow_tag() );
}
long use_count() const // never throws
Modified: branches/release/libs/smart_ptr/shared_ptr.htm
==============================================================================
--- branches/release/libs/smart_ptr/shared_ptr.htm (original)
+++ branches/release/libs/smart_ptr/shared_ptr.htm 2008-07-12 05:55:08 EDT (Sat, 12 Jul 2008)
@@ -373,8 +373,8 @@
<pre>long use_count() const; // never throws</pre>
<blockquote>
<p><b>Returns:</b> the number of <b>shared_ptr</b> objects, <STRONG>*this</STRONG> included,
- that <i>share ownership</i> with <b>*this</b>, or an unspecified nonnegative
- value when <STRONG>*this</STRONG> is <EM>empty</EM>.</p>
+ that <i>share ownership</i> with <b>*this</b>, or 0 when <STRONG>*this</STRONG>
+ is <EM>empty</EM>.</p>
<p><b>Throws:</b> nothing.</p>
<P><B>Notes:</B> <code>use_count()</code> is not necessarily efficient. Use only
for debugging and testing purposes, not for production code.</P>
@@ -522,6 +522,7 @@
<P><B>Returns:</B> If <STRONG>*this</STRONG> <EM>owns</EM> a deleter <STRONG>d</STRONG>
of type (cv-unqualified) <STRONG>D</STRONG>, returns <code>&d</code>;
otherwise returns 0.</P>
+ <P><B>Throws:</B> nothing.</P>
</BLOCKQUOTE>
<h2><a name="example">Example</a></h2>
<p>See shared_ptr_example.cpp for a
@@ -709,8 +710,8 @@
<p>
$Date$</p>
<p><small>Copyright 1999 Greg Colvin and Beman Dawes. Copyright 2002 Darin Adler.
- Copyright 2002-2005 Peter Dimov. 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.</small></p>
+ Copyright 2002-2005 Peter Dimov. 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.</small></p>
</body>
</html>
Modified: branches/release/libs/smart_ptr/test/Jamfile.v2
==============================================================================
--- branches/release/libs/smart_ptr/test/Jamfile.v2 (original)
+++ branches/release/libs/smart_ptr/test/Jamfile.v2 2008-07-12 05:55:08 EDT (Sat, 12 Jul 2008)
@@ -33,5 +33,14 @@
[ run shared_ptr_move_test.cpp ]
[ compile-fail shared_ptr_pv_fail.cpp ]
[ run sp_unary_addr_test.cpp ]
+ [ compile-fail scoped_ptr_eq_fail.cpp ]
+ [ compile-fail scoped_array_eq_fail.cpp ]
+ [ run esft_regtest.cpp ]
+ [ run yield_k_test.cpp ]
+ [ run yield_k_test.cpp : : : <threading>multi : yield_k_test.mt ]
+ [ run spinlock_test.cpp ]
+ [ run spinlock_try_test.cpp ]
+ [ run spinlock_try_test.cpp : : : <threading>multi : spinlock_try_test.mt ]
+ [ run spinlock_pool_test.cpp ]
;
}
Modified: branches/release/libs/smart_ptr/test/shared_from_this_test.cpp
==============================================================================
--- branches/release/libs/smart_ptr/test/shared_from_this_test.cpp (original)
+++ branches/release/libs/smart_ptr/test/shared_from_this_test.cpp 2008-07-12 05:55:08 EDT (Sat, 12 Jul 2008)
@@ -133,7 +133,8 @@
try
{
boost::shared_ptr<V> r = v2.shared_from_this();
- BOOST_ERROR("v2.shared_from_this() failed to throw");
+ BOOST_TEST( p < r || r < p );
+ BOOST_TEST( r.get() == &v2 );
}
catch(boost::bad_weak_ptr const &)
{
Modified: branches/release/libs/smart_ptr/test/shared_ptr_test.cpp
==============================================================================
--- branches/release/libs/smart_ptr/test/shared_ptr_test.cpp (original)
+++ branches/release/libs/smart_ptr/test/shared_ptr_test.cpp 2008-07-12 05:55:08 EDT (Sat, 12 Jul 2008)
@@ -62,6 +62,7 @@
BOOST_TEST(pi? false: true);
BOOST_TEST(!pi);
BOOST_TEST(pi.get() == 0);
+ BOOST_TEST(pi.use_count() == 0);
}
{
@@ -69,6 +70,7 @@
BOOST_TEST(pv? false: true);
BOOST_TEST(!pv);
BOOST_TEST(pv.get() == 0);
+ BOOST_TEST(pv.use_count() == 0);
}
{
@@ -76,6 +78,7 @@
BOOST_TEST(px? false: true);
BOOST_TEST(!px);
BOOST_TEST(px.get() == 0);
+ BOOST_TEST(px.use_count() == 0);
}
}
@@ -1565,6 +1568,7 @@
BOOST_TEST(pi? false: true);
BOOST_TEST(!pi);
BOOST_TEST(pi.get() == 0);
+ BOOST_TEST(pi.use_count() == 0);
}
{
@@ -1573,6 +1577,7 @@
BOOST_TEST(pi? false: true);
BOOST_TEST(!pi);
BOOST_TEST(pi.get() == 0);
+ BOOST_TEST(pi.use_count() == 0);
}
{
@@ -1581,6 +1586,7 @@
BOOST_TEST(pi? false: true);
BOOST_TEST(!pi);
BOOST_TEST(pi.get() == 0);
+ BOOST_TEST(pi.use_count() == 0);
}
{
@@ -1589,6 +1595,7 @@
BOOST_TEST(px? false: true);
BOOST_TEST(!px);
BOOST_TEST(px.get() == 0);
+ BOOST_TEST(px.use_count() == 0);
}
{
@@ -1597,6 +1604,7 @@
BOOST_TEST(px? false: true);
BOOST_TEST(!px);
BOOST_TEST(px.get() == 0);
+ BOOST_TEST(px.use_count() == 0);
}
{
@@ -1605,6 +1613,7 @@
BOOST_TEST(px? false: true);
BOOST_TEST(!px);
BOOST_TEST(px.get() == 0);
+ BOOST_TEST(px.use_count() == 0);
}
{
@@ -1615,6 +1624,7 @@
BOOST_TEST(px? false: true);
BOOST_TEST(!px);
BOOST_TEST(px.get() == 0);
+ BOOST_TEST(px.use_count() == 0);
BOOST_TEST(X::instances == 0);
}
@@ -1624,6 +1634,7 @@
BOOST_TEST(pv? false: true);
BOOST_TEST(!pv);
BOOST_TEST(pv.get() == 0);
+ BOOST_TEST(pv.use_count() == 0);
}
{
@@ -1634,6 +1645,7 @@
BOOST_TEST(pv? false: true);
BOOST_TEST(!pv);
BOOST_TEST(pv.get() == 0);
+ BOOST_TEST(pv.use_count() == 0);
BOOST_TEST(X::instances == 0);
}
}
Copied: branches/release/libs/smart_ptr/test/spinlock_test.cpp (from r43950, /trunk/libs/smart_ptr/test/spinlock_test.cpp)
==============================================================================
--- /trunk/libs/smart_ptr/test/spinlock_test.cpp (original)
+++ branches/release/libs/smart_ptr/test/spinlock_test.cpp 2008-07-12 05:55:08 EDT (Sat, 12 Jul 2008)
@@ -9,7 +9,6 @@
//
#include <boost/detail/spinlock.hpp>
-#include <boost/detail/lightweight_test.hpp>
// Sanity check only
@@ -18,29 +17,15 @@
int main()
{
- BOOST_TEST( sp.try_lock() );
- BOOST_TEST( !sp.try_lock() );
- BOOST_TEST( sp2.try_lock() );
- BOOST_TEST( !sp.try_lock() );
- BOOST_TEST( !sp2.try_lock() );
- sp.unlock();
- sp2.unlock();
-
sp.lock();
- BOOST_TEST( !sp.try_lock() );
sp2.lock();
- BOOST_TEST( !sp.try_lock() );
- BOOST_TEST( !sp2.try_lock() );
sp.unlock();
sp2.unlock();
{
boost::detail::spinlock::scoped_lock lock( sp );
- BOOST_TEST( !sp.try_lock() );
boost::detail::spinlock::scoped_lock lock2( sp2 );
- BOOST_TEST( !sp.try_lock() );
- BOOST_TEST( !sp2.try_lock() );
}
- return boost::report_errors();
+ return 0;
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk