|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58322 - in sandbox/fiber: boost boost/fiber libs/fiber/examples libs/fiber/src libs/fiber/test
From: oliver.kowalke_at_[hidden]
Date: 2009-12-12 05:19:30
Author: olli
Date: 2009-12-12 05:19:29 EST (Sat, 12 Dec 2009)
New Revision: 58322
URL: http://svn.boost.org/trac/boost/changeset/58322
Log:
- support of future (only spinning) added
- example for multithreaded sync via fifo added
- example for multithreaded fsync vai future added
Text files modified:
sandbox/fiber/boost/fiber.hpp | 15 ++++++----
sandbox/fiber/boost/fiber/fiber.hpp | 22 ++++++++--------
sandbox/fiber/libs/fiber/examples/barrier_mt.cpp | 10 +++---
sandbox/fiber/libs/fiber/examples/ping_pong.cpp | 53 ++++++++++++++++++--------------------
sandbox/fiber/libs/fiber/examples/ping_pong_mt.cpp | 51 ++++++++++++++++++------------------
sandbox/fiber/libs/fiber/src/condition.cpp | 55 ----------------------------------------
sandbox/fiber/libs/fiber/src/fiber.cpp | 10 +++---
sandbox/fiber/libs/fiber/src/round_robin.cpp | 2
sandbox/fiber/libs/fiber/test/test_spin_auto_reset_event.cpp | 8 ++--
sandbox/fiber/libs/fiber/test/test_spin_barrier.cpp | 8 ++--
sandbox/fiber/libs/fiber/test/test_spin_condition.cpp | 22 ++++++++--------
sandbox/fiber/libs/fiber/test/test_spin_count_down_event.cpp | 6 ++--
sandbox/fiber/libs/fiber/test/test_spin_lock.cpp | 38 +++++++++++++-------------
sandbox/fiber/libs/fiber/test/test_spin_manual_reset_event.cpp | 10 +++---
sandbox/fiber/libs/fiber/test/test_spin_mutex.cpp | 14 +++++-----
15 files changed, 134 insertions(+), 190 deletions(-)
Modified: sandbox/fiber/boost/fiber.hpp
==============================================================================
--- sandbox/fiber/boost/fiber.hpp (original)
+++ sandbox/fiber/boost/fiber.hpp 2009-12-12 05:19:29 EST (Sat, 12 Dec 2009)
@@ -18,12 +18,15 @@
#include <boost/fiber/manual_reset_event.hpp>
#include <boost/fiber/mutex.hpp>
#include <boost/fiber/scheduler.hpp>
-#include <boost/fiber/spin_auto_reset_event.hpp>
-#include <boost/fiber/spin_barrier.hpp>
-#include <boost/fiber/spin_condition.hpp>
-#include <boost/fiber/spin_count_down_event.hpp>
-#include <boost/fiber/spin_manual_reset_event.hpp>
-#include <boost/fiber/spin_mutex.hpp>
+#include <boost/fiber/spin/auto_reset_event.hpp>
+#include <boost/fiber/spin/barrier.hpp>
+#include <boost/fiber/spin/bounded_fifo.hpp>
+#include <boost/fiber/spin/condition.hpp>
+#include <boost/fiber/spin/count_down_event.hpp>
+//#include <boost/fiber/spin/future.hpp>
+#include <boost/fiber/spin/manual_reset_event.hpp>
+#include <boost/fiber/spin/mutex.hpp>
+#include <boost/fiber/spin/unbounded_fifo.hpp>
#include <boost/fiber/unbounded_fifo.hpp>
#include <boost/fiber/utility.hpp>
Modified: sandbox/fiber/boost/fiber/fiber.hpp
==============================================================================
--- sandbox/fiber/boost/fiber/fiber.hpp (original)
+++ sandbox/fiber/boost/fiber/fiber.hpp 2009-12-12 05:19:29 EST (Sat, 12 Dec 2009)
@@ -13,13 +13,13 @@
#include <boost/bind.hpp>
#include <boost/config.hpp>
#include <boost/preprocessor/repetition.hpp>
+#include <boost/thread/detail/move.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/utility.hpp>
#include <boost/fiber/detail/config.hpp>
#include <boost/fiber/detail/info.hpp>
-#include <boost/fiber/detail/move.hpp>
#include <boost/config/abi_prefix.hpp>
@@ -78,7 +78,7 @@
template< typename Fn >
static detail::info_base::ptr_t make_info_(
- std::size_t stack_size, boost::detail::fiber_move_t< Fn > fn)
+ std::size_t stack_size, boost::detail::thread_move_t< Fn > fn)
{
return detail::info_base::ptr_t(
new detail::info< Fn >( fn, stack_size) );
@@ -120,34 +120,34 @@
template< typename Fn >
explicit fiber(
Fn fn,
- typename disable_if< boost::is_convertible< Fn &, boost::detail::fiber_move_t< Fn > >, dummy * >::type = 0) :
+ typename disable_if< boost::is_convertible< Fn &, boost::detail::thread_move_t< Fn > >, dummy * >::type = 0) :
info_base_( make_info_( BOOST_FIBER_DEFAULT_STACKSIZE, fn) )
{ init_(); }
template< typename Fn >
explicit fiber(
std::size_t stack_size, Fn fn,
- typename disable_if< boost::is_convertible< Fn &, boost::detail::fiber_move_t< Fn > >, dummy * >::type = 0) :
+ typename disable_if< boost::is_convertible< Fn &, boost::detail::thread_move_t< Fn > >, dummy * >::type = 0) :
info_base_( make_info_( stack_size, fn) )
{ init_(); }
#endif
template< typename Fn >
- explicit fiber( boost::detail::fiber_move_t< Fn > fn) :
+ explicit fiber( boost::detail::thread_move_t< Fn > fn) :
info_base_( make_info_( BOOST_FIBER_DEFAULT_STACKSIZE, fn) )
{ init_(); }
template< typename Fn >
- explicit fiber( std::size_t stack_size, boost::detail::fiber_move_t< Fn > fn) :
+ explicit fiber( std::size_t stack_size, boost::detail::thread_move_t< Fn > fn) :
info_base_( make_info_( stack_size, fn) )
{ init_(); }
- fiber( boost::detail::fiber_move_t< fiber >);
+ fiber( boost::detail::thread_move_t< fiber >);
- fiber & operator=( boost::detail::fiber_move_t< fiber >);
+ fiber & operator=( boost::detail::thread_move_t< fiber >);
- operator boost::detail::fiber_move_t< fiber >();
+ operator boost::detail::thread_move_t< fiber >();
- boost::detail::fiber_move_t< fiber > move();
+ boost::detail::thread_move_t< fiber > move();
#endif
#define BOOST_FIBER_ARG(z, n, unused) \
@@ -290,7 +290,7 @@
{ return f; }
#else
inline
-fiber move( boost::detail::fiber_move_t< fiber > f)
+fiber move( boost::detail::thread_move_t< fiber > f)
{ return fiber( f); }
#endif
Modified: sandbox/fiber/libs/fiber/examples/barrier_mt.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/examples/barrier_mt.cpp (original)
+++ sandbox/fiber/libs/fiber/examples/barrier_mt.cpp 2009-12-12 05:19:29 EST (Sat, 12 Dec 2009)
@@ -14,7 +14,7 @@
int value2 = 0;
inline
-void fn1( boost::fibers::spin_barrier & b)
+void fn1( boost::fibers::spin::barrier & b)
{
std::stringstream tss;
tss << boost::this_thread::get_id();
@@ -46,7 +46,7 @@
}
inline
-void fn2( boost::fibers::spin_barrier & b)
+void fn2( boost::fibers::spin::barrier & b)
{
std::stringstream tss;
tss << boost::this_thread::get_id();
@@ -79,7 +79,7 @@
void f(
boost::barrier & tb,
- boost::fibers::spin_barrier & fb)
+ boost::fibers::spin::barrier & fb)
{
std::stringstream tss;
tss << boost::this_thread::get_id();
@@ -103,7 +103,7 @@
void g(
boost::barrier & tb,
- boost::fibers::spin_barrier & fb)
+ boost::fibers::spin::barrier & fb)
{
std::stringstream tss;
tss << boost::this_thread::get_id();
@@ -130,7 +130,7 @@
try
{
boost::barrier tb( 2);
- boost::fibers::spin_barrier fb( 2);
+ boost::fibers::spin::barrier fb( 2);
std::cout << "start" << std::endl;
Modified: sandbox/fiber/libs/fiber/examples/ping_pong.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/examples/ping_pong.cpp (original)
+++ sandbox/fiber/libs/fiber/examples/ping_pong.cpp 2009-12-12 05:19:29 EST (Sat, 12 Dec 2009)
@@ -10,69 +10,66 @@
#include <boost/fiber.hpp>
-typedef boost::fibers::unbounded_fifo< std::string, boost::fibers::mutex > fifo_t;
-//typedef boost::fibers::unbounded_fifo< std::string, boost::fibers::spin_mutex > fifo_t;
-typedef boost::intrusive_ptr< fifo_t > fifo_ptr_t;
+typedef boost::fibers::unbounded_fifo< std::string > fifo_t;
+typedef boost::intrusive_ptr< fifo_t > fifo_ptr_t;
+
inline
void ping(
- fifo_ptr_t & recv_buf,
- fifo_ptr_t & send_buf)
+ fifo_t & recv_buf,
+ fifo_t & send_buf)
{
boost::optional< std::string > value;
- send_buf->put("ping");
- BOOST_ASSERT( recv_buf->take( value) );
+ send_buf.put("ping");
+ BOOST_ASSERT( recv_buf.take( value) );
std::cout << * value << std::endl;
value.reset();
- send_buf->put("ping");
- BOOST_ASSERT( recv_buf->take( value) );
+ send_buf.put("ping");
+ BOOST_ASSERT( recv_buf.take( value) );
std::cout << * value << std::endl;
value.reset();
- send_buf->put("ping");
- BOOST_ASSERT( recv_buf->take( value) );
+ send_buf.put("ping");
+ BOOST_ASSERT( recv_buf.take( value) );
std::cout << * value << std::endl;
value.reset();
- send_buf->deactivate();
+ send_buf.deactivate();
}
inline
void pong(
- fifo_ptr_t & recv_buf,
- fifo_ptr_t & send_buf)
+ fifo_t & recv_buf,
+ fifo_t & send_buf)
{
boost::optional< std::string > value;
- BOOST_ASSERT( recv_buf->take( value) );
+ BOOST_ASSERT( recv_buf.take( value) );
std::cout << * value << std::endl;
value.reset();
- send_buf->put("pong");
+ send_buf.put("pong");
- BOOST_ASSERT( recv_buf->take( value) );
+ BOOST_ASSERT( recv_buf.take( value) );
std::cout << * value << std::endl;
value.reset();
- send_buf->put("pong");
+ send_buf.put("pong");
- BOOST_ASSERT( recv_buf->take( value) );
+ BOOST_ASSERT( recv_buf.take( value) );
std::cout << * value << std::endl;
value.reset();
- send_buf->put("pong");
+ send_buf.put("pong");
- send_buf->deactivate();
+ send_buf.deactivate();
}
void f( boost::fibers::scheduler<> & sched)
{
- fifo_ptr_t buf1( new fifo_t( sched) );
- fifo_ptr_t buf2( new fifo_t( sched) );
-
-// fifo_ptr_t buf1( new fifo_t() );
-// fifo_ptr_t buf2( new fifo_t() );
+ fifo_t buf1( sched);
+ fifo_t buf2( sched);
- sched.make_fiber( & ping, buf1, buf2);
- sched.make_fiber( & pong, buf2, buf1);
+ sched.make_fiber( & ping, boost::ref( buf1), boost::ref( buf2) );
+ sched.make_fiber( & pong, boost::ref( buf2), boost::ref( buf1) );
}
int main()
Modified: sandbox/fiber/libs/fiber/examples/ping_pong_mt.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/examples/ping_pong_mt.cpp (original)
+++ sandbox/fiber/libs/fiber/examples/ping_pong_mt.cpp 2009-12-12 05:19:29 EST (Sat, 12 Dec 2009)
@@ -12,13 +12,12 @@
#include <boost/fiber.hpp>
-typedef boost::fibers::unbounded_fifo< std::string, boost::fibers::spin_mutex > fifo_t;
-typedef boost::intrusive_ptr< fifo_t > fifo_ptr_t;
+typedef boost::fibers::spin::unbounded_fifo< std::string > fifo_t;
inline
void ping(
- fifo_ptr_t & recv_buf,
- fifo_ptr_t & send_buf)
+ fifo_t & recv_buf,
+ fifo_t & send_buf)
{
std::stringstream tss;
tss << boost::this_thread::get_id();
@@ -29,30 +28,30 @@
boost::optional< std::string > value;
- send_buf->put("ping");
- BOOST_ASSERT( recv_buf->take( value) );
+ send_buf.put("ping");
+ BOOST_ASSERT( recv_buf.take( value) );
fprintf( stderr, "ping fiber %s in thread %s recevied %s\n", fss.str().c_str(), tss.str().c_str(), value->c_str());
value.reset();
- send_buf->put("ping");
- BOOST_ASSERT( recv_buf->take( value) );
+ send_buf.put("ping");
+ BOOST_ASSERT( recv_buf.take( value) );
fprintf( stderr, "ping fiber %s in thread %s recevied %s\n", fss.str().c_str(), tss.str().c_str(), value->c_str());
value.reset();
- send_buf->put("ping");
- BOOST_ASSERT( recv_buf->take( value) );
+ send_buf.put("ping");
+ BOOST_ASSERT( recv_buf.take( value) );
fprintf( stderr, "ping fiber %s in thread %s recevied %s\n", fss.str().c_str(), tss.str().c_str(), value->c_str());
value.reset();
- send_buf->deactivate();
+ send_buf.deactivate();
fprintf( stderr, "end ping fiber %s in thread %s\n", fss.str().c_str(), tss.str().c_str() );
}
inline
void pong(
- fifo_ptr_t & recv_buf,
- fifo_ptr_t & send_buf)
+ fifo_t & recv_buf,
+ fifo_t & send_buf)
{
std::stringstream tss;
tss << boost::this_thread::get_id();
@@ -63,29 +62,29 @@
boost::optional< std::string > value;
- BOOST_ASSERT( recv_buf->take( value) );
+ BOOST_ASSERT( recv_buf.take( value) );
fprintf( stderr, "pong fiber %s in thread %s recevied %s\n", fss.str().c_str(), tss.str().c_str(), value->c_str());
value.reset();
- send_buf->put("pong");
+ send_buf.put("pong");
- BOOST_ASSERT( recv_buf->take( value) );
+ BOOST_ASSERT( recv_buf.take( value) );
fprintf( stderr, "pong fiber %s in thread %s recevied %s\n", fss.str().c_str(), tss.str().c_str(), value->c_str());
value.reset();
- send_buf->put("pong");
+ send_buf.put("pong");
- BOOST_ASSERT( recv_buf->take( value) );
+ BOOST_ASSERT( recv_buf.take( value) );
fprintf( stderr, "pong fiber %s in thread %s recevied %s\n", fss.str().c_str(), tss.str().c_str(), value->c_str());
value.reset();
- send_buf->put("pong");
+ send_buf.put("pong");
- send_buf->deactivate();
+ send_buf.deactivate();
fprintf( stderr, "end pong fiber %s in thread %s\n", fss.str().c_str(), tss.str().c_str() );
}
void f(
- fifo_ptr_t & recv_buf,
- fifo_ptr_t & send_buf)
+ fifo_t & recv_buf,
+ fifo_t & send_buf)
{
std::stringstream tss;
tss << boost::this_thread::get_id();
@@ -106,8 +105,8 @@
}
void g(
- fifo_ptr_t & recv_buf,
- fifo_ptr_t & send_buf)
+ fifo_t & recv_buf,
+ fifo_t & send_buf)
{
std::stringstream tss;
tss << boost::this_thread::get_id();
@@ -131,8 +130,8 @@
{
try
{
- fifo_ptr_t buf1( new fifo_t() );
- fifo_ptr_t buf2( new fifo_t() );
+ fifo_t buf1;
+ fifo_t buf2;
std::cout << "start" << std::endl;
Modified: sandbox/fiber/libs/fiber/src/condition.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/src/condition.cpp (original)
+++ sandbox/fiber/libs/fiber/src/condition.cpp 2009-12-12 05:19:29 EST (Sat, 12 Dec 2009)
@@ -6,66 +6,11 @@
#include "boost/fiber/condition.hpp"
-#include <boost/assert.hpp>
-#include <boost/thread.hpp>
-
-#include <boost/fiber/detail/atomic.hpp>
#include <boost/fiber/utility.hpp>
namespace boost {
namespace fibers {
-void
-condition::wait_( mutex & mtx)
-{
- {
- mutex::scoped_lock lk( enter_mtx_);
- BOOST_ASSERT( lk);
- detail::atomic_fetch_add( & waiters_, 1);
- mtx.unlock();
- }
-
- bool unlock_enter_mtx = false;
- for (;;)
- {
- while ( static_cast< uint32_t >( SLEEPING) == detail::atomic_load( & cmd_) )
- strategy_->wait_for_object( id_);
-
- mutex::scoped_lock lk( check_mtx_);
- BOOST_ASSERT( lk);
-
- uint32_t expected = static_cast< uint32_t >( NOTIFY_ONE);
- detail::atomic_compare_exchange_strong(
- & cmd_, & expected,
- static_cast< uint32_t >( SLEEPING) );
- if ( static_cast< uint32_t >( SLEEPING) == expected)
- continue;
- else if ( static_cast< uint32_t >( NOTIFY_ONE) == expected)
- {
- unlock_enter_mtx = true;
- detail::atomic_fetch_sub( & waiters_, 1);
- break;
- }
- else
- {
- unlock_enter_mtx = 1 == detail::atomic_fetch_sub( & waiters_, 1);
- if ( unlock_enter_mtx)
- {
- expected = static_cast< uint32_t >( NOTIFY_ALL);
- detail::atomic_compare_exchange_strong(
- & cmd_, & expected,
- static_cast< uint32_t >( SLEEPING) );
- }
- break;
- }
- }
-
- if ( unlock_enter_mtx)
- enter_mtx_.unlock();
-
- mtx.lock();
-}
-
condition::~condition()
{ strategy_->unregister_object( id_); }
Modified: sandbox/fiber/libs/fiber/src/fiber.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/src/fiber.cpp (original)
+++ sandbox/fiber/libs/fiber/src/fiber.cpp 2009-12-12 05:19:29 EST (Sat, 12 Dec 2009)
@@ -51,27 +51,27 @@
fiber::move()
{ return static_cast< fiber && >( * this); }
#else
-fiber::fiber( boost::detail::fiber_move_t< fiber > f)
+fiber::fiber( boost::detail::thread_move_t< fiber > f)
{
info_base_ = f->info_base_;
f->info_base_.reset();
}
fiber &
-fiber::operator=( boost::detail::fiber_move_t< fiber > f)
+fiber::operator=( boost::detail::thread_move_t< fiber > f)
{
fiber new_fiber( f);
swap( new_fiber);
return * this;
}
-fiber::operator boost::detail::fiber_move_t< fiber >()
+fiber::operator boost::detail::thread_move_t< fiber >()
{ return move(); }
-boost::detail::fiber_move_t< fiber >
+boost::detail::thread_move_t< fiber >
fiber::move()
{
- boost::detail::fiber_move_t< fiber > f( * this);
+ boost::detail::thread_move_t< fiber > f( * this);
return f;
}
#endif
Modified: sandbox/fiber/libs/fiber/src/round_robin.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/src/round_robin.cpp (original)
+++ sandbox/fiber/libs/fiber/src/round_robin.cpp 2009-12-12 05:19:29 EST (Sat, 12 Dec 2009)
@@ -11,8 +11,8 @@
#include <boost/assert.hpp>
#include <boost/foreach.hpp>
+#include <boost/thread/detail/move.hpp>
-#include <boost/fiber/detail/move.hpp>
#include <boost/fiber/exceptions.hpp>
#include <boost/config/abi_prefix.hpp>
Modified: sandbox/fiber/libs/fiber/test/test_spin_auto_reset_event.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/test/test_spin_auto_reset_event.cpp (original)
+++ sandbox/fiber/libs/fiber/test/test_spin_auto_reset_event.cpp 2009-12-12 05:19:29 EST (Sat, 12 Dec 2009)
@@ -21,7 +21,7 @@
int value = 0;
-void wait_fn( boost::fibers::spin_auto_reset_event & ev)
+void wait_fn( boost::fibers::spin::auto_reset_event & ev)
{
ev.wait();
++value;
@@ -31,7 +31,7 @@
void test_case_1()
{
value = 0;
- boost::fibers::spin_auto_reset_event ev;
+ boost::fibers::spin::auto_reset_event ev;
boost::fibers::scheduler<> sched;
sched.make_fiber(
@@ -69,7 +69,7 @@
void test_case_2()
{
value = 0;
- boost::fibers::spin_auto_reset_event ev( true);
+ boost::fibers::spin::auto_reset_event ev( true);
boost::fibers::scheduler<> sched;
sched.make_fiber(
@@ -100,7 +100,7 @@
void test_case_3()
{
- boost::fibers::spin_auto_reset_event ev;
+ boost::fibers::spin::auto_reset_event ev;
BOOST_CHECK_EQUAL( false, ev.try_wait() );
Modified: sandbox/fiber/libs/fiber/test/test_spin_barrier.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/test/test_spin_barrier.cpp (original)
+++ sandbox/fiber/libs/fiber/test/test_spin_barrier.cpp 2009-12-12 05:19:29 EST (Sat, 12 Dec 2009)
@@ -15,7 +15,7 @@
int value1 = 0;
int value2 = 0;
-void fn_1( boost::fibers::spin_barrier & b)
+void fn_1( boost::fibers::spin::barrier & b)
{
++value1;
boost::this_fiber::yield();
@@ -31,7 +31,7 @@
++value1;
}
-void fn_2( boost::fibers::spin_barrier & b)
+void fn_2( boost::fibers::spin::barrier & b)
{
++value2;
boost::this_fiber::yield();
@@ -54,7 +54,7 @@
boost::fibers::scheduler<> sched;
- boost::fibers::spin_barrier b( 2);
+ boost::fibers::spin::barrier b( 2);
sched.make_fiber( fn_1, boost::ref( b) );
sched.make_fiber( fn_2, boost::ref( b) );
@@ -149,7 +149,7 @@
boost::unit_test::test_suite * init_unit_test_suite( int, char* [])
{
boost::unit_test::test_suite * test =
- BOOST_TEST_SUITE("Boost.Fiber: spin_barrier test suite");
+ BOOST_TEST_SUITE("Boost.Fiber: spin::barrier test suite");
test->add( BOOST_TEST_CASE( & test_case_1) );
Modified: sandbox/fiber/libs/fiber/test/test_spin_condition.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/test/test_spin_condition.cpp (original)
+++ sandbox/fiber/libs/fiber/test/test_spin_condition.cpp 2009-12-12 05:19:29 EST (Sat, 12 Dec 2009)
@@ -21,21 +21,21 @@
int value = 0;
-void notify_one_fn( boost::fibers::spin_condition & cond)
+void notify_one_fn( boost::fibers::spin::condition & cond)
{
cond.notify_one();
}
-void notify_all_fn( boost::fibers::spin_condition & cond)
+void notify_all_fn( boost::fibers::spin::condition & cond)
{
cond.notify_all();
}
void wait_fn(
- boost::fibers::spin_mutex & mtx,
- boost::fibers::spin_condition & cond)
+ boost::fibers::spin::mutex & mtx,
+ boost::fibers::spin::condition & cond)
{
- boost::fibers::spin_mutex::scoped_lock lk( mtx);
+ boost::fibers::spin::mutex::scoped_lock lk( mtx);
cond.wait( lk);
++value;
}
@@ -43,8 +43,8 @@
void test_case_1()
{
value = 0;
- boost::fibers::spin_mutex mtx;
- boost::fibers::spin_condition cond;
+ boost::fibers::spin::mutex mtx;
+ boost::fibers::spin::condition cond;
boost::fibers::scheduler<> sched;
sched.make_fiber(
@@ -84,8 +84,8 @@
void test_case_2()
{
value = 0;
- boost::fibers::spin_mutex mtx;
- boost::fibers::spin_condition cond;
+ boost::fibers::spin::mutex mtx;
+ boost::fibers::spin::condition cond;
boost::fibers::scheduler<> sched;
sched.make_fiber(
@@ -138,8 +138,8 @@
void test_case_3()
{
value = 0;
- boost::fibers::spin_mutex mtx;
- boost::fibers::spin_condition cond;
+ boost::fibers::spin::mutex mtx;
+ boost::fibers::spin::condition cond;
boost::fibers::scheduler<> sched;
sched.make_fiber(
Modified: sandbox/fiber/libs/fiber/test/test_spin_count_down_event.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/test/test_spin_count_down_event.cpp (original)
+++ sandbox/fiber/libs/fiber/test/test_spin_count_down_event.cpp 2009-12-12 05:19:29 EST (Sat, 12 Dec 2009)
@@ -21,7 +21,7 @@
int value = 0;
-void wait_fn( boost::fibers::spin_count_down_event & ev)
+void wait_fn( boost::fibers::spin::count_down_event & ev)
{
ev.wait();
++value;
@@ -30,7 +30,7 @@
void test_case_1()
{
boost::uint32_t n = 3;
- boost::fibers::spin_count_down_event ev( n);
+ boost::fibers::spin::count_down_event ev( n);
BOOST_CHECK_EQUAL( ev.initial(), n);
BOOST_CHECK_EQUAL( ev.current(), n);
@@ -56,7 +56,7 @@
{
value = 0;
boost::uint32_t n = 3;
- boost::fibers::spin_count_down_event ev( n);
+ boost::fibers::spin::count_down_event ev( n);
boost::fibers::scheduler<> sched;
BOOST_CHECK_EQUAL( ev.initial(), n);
Modified: sandbox/fiber/libs/fiber/test/test_spin_lock.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/test/test_spin_lock.cpp (original)
+++ sandbox/fiber/libs/fiber/test/test_spin_lock.cpp 2009-12-12 05:19:29 EST (Sat, 12 Dec 2009)
@@ -45,8 +45,8 @@
void test_lock()
{
- boost::fibers::spin_mutex mtx;
- boost::unique_lock< boost::fibers::spin_mutex > lk( mtx);
+ boost::fibers::spin::mutex mtx;
+ boost::unique_lock< boost::fibers::spin::mutex > lk( mtx);
BOOST_CHECK( lk);
BOOST_CHECK( lk.owns_lock() );
@@ -59,8 +59,8 @@
void test_defer_lock()
{
- boost::fibers::spin_mutex mtx;
- boost::unique_lock< boost::fibers::spin_mutex > lk( mtx, boost::defer_lock);
+ boost::fibers::spin::mutex mtx;
+ boost::unique_lock< boost::fibers::spin::mutex > lk( mtx, boost::defer_lock);
BOOST_CHECK( ! lk);
BOOST_CHECK( ! lk.owns_lock() );
@@ -73,9 +73,9 @@
void test_adopt_lock()
{
- boost::fibers::spin_mutex mtx;
+ boost::fibers::spin::mutex mtx;
mtx.lock();
- boost::unique_lock< boost::fibers::spin_mutex > lk( mtx, boost::adopt_lock);
+ boost::unique_lock< boost::fibers::spin::mutex > lk( mtx, boost::adopt_lock);
BOOST_CHECK( lk);
BOOST_CHECK( lk.owns_lock() );
@@ -83,8 +83,8 @@
void test_try_lock()
{
- boost::fibers::spin_mutex mtx;
- boost::unique_lock< boost::fibers::spin_mutex > lk( mtx, boost::defer_lock);
+ boost::fibers::spin::mutex mtx;
+ boost::unique_lock< boost::fibers::spin::mutex > lk( mtx, boost::defer_lock);
BOOST_CHECK( ! lk);
BOOST_CHECK( ! lk.owns_lock() );
@@ -97,24 +97,24 @@
void test_lock_twice()
{
- boost::fibers::spin_mutex mtx;
- boost::unique_lock< boost::fibers::spin_mutex > lk( mtx);
+ boost::fibers::spin::mutex mtx;
+ boost::unique_lock< boost::fibers::spin::mutex > lk( mtx);
BOOST_CHECK_THROW( lk.lock(), boost::lock_error);
}
void test_try_lock_twice()
{
- boost::fibers::spin_mutex mtx;
- boost::unique_lock< boost::fibers::spin_mutex > lk( mtx);
+ boost::fibers::spin::mutex mtx;
+ boost::unique_lock< boost::fibers::spin::mutex > lk( mtx);
BOOST_CHECK_THROW( lk.try_lock(), boost::lock_error);
}
void test_unlock_twice()
{
- boost::fibers::spin_mutex mtx;
- boost::unique_lock< boost::fibers::spin_mutex > lk( mtx);
+ boost::fibers::spin::mutex mtx;
+ boost::unique_lock< boost::fibers::spin::mutex > lk( mtx);
lk.unlock();
BOOST_CHECK_THROW( lk.unlock(), boost::lock_error);
@@ -122,7 +122,7 @@
void test_default_ctor()
{
- boost::unique_lock< boost::fibers::spin_mutex > lk;
+ boost::unique_lock< boost::fibers::spin::mutex > lk;
BOOST_CHECK( ! lk);
BOOST_CHECK( ! lk.owns_lock() );
@@ -130,9 +130,9 @@
void test_lock_concept()
{
- boost::fibers::spin_mutex mtx1, mtx2, mtx3;
+ boost::fibers::spin::mutex mtx1, mtx2, mtx3;
- boost::fibers::spin_mutex::scoped_lock lk1( mtx1, boost::defer_lock),
+ boost::fibers::spin::mutex::scoped_lock lk1( mtx1, boost::defer_lock),
lk2( mtx2, boost::defer_lock),
lk3( mtx3, boost::defer_lock);
@@ -166,9 +166,9 @@
void test_swap()
{
- boost::fibers::spin_mutex mtx1, mtx2;
+ boost::fibers::spin::mutex mtx1, mtx2;
- boost::unique_lock< boost::fibers::spin_mutex > lk1( mtx1), lk2( mtx2);
+ boost::unique_lock< boost::fibers::spin::mutex > lk1( mtx1), lk2( mtx2);
BOOST_CHECK_EQUAL( lk1.mutex(), & mtx1);
BOOST_CHECK_EQUAL( lk2.mutex(), & mtx2);
Modified: sandbox/fiber/libs/fiber/test/test_spin_manual_reset_event.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/test/test_spin_manual_reset_event.cpp (original)
+++ sandbox/fiber/libs/fiber/test/test_spin_manual_reset_event.cpp 2009-12-12 05:19:29 EST (Sat, 12 Dec 2009)
@@ -21,7 +21,7 @@
int value = 0;
-void wait_fn( boost::fibers::spin_manual_reset_event & ev)
+void wait_fn( boost::fibers::spin::manual_reset_event & ev)
{
ev.wait();
++value;
@@ -30,7 +30,7 @@
void test_case_1()
{
value = 0;
- boost::fibers::spin_manual_reset_event ev;
+ boost::fibers::spin::manual_reset_event ev;
boost::fibers::scheduler<> sched;
sched.make_fiber(
@@ -60,7 +60,7 @@
void test_case_2()
{
value = 0;
- boost::fibers::spin_manual_reset_event ev;
+ boost::fibers::spin::manual_reset_event ev;
boost::fibers::scheduler<> sched;
sched.make_fiber(
@@ -106,7 +106,7 @@
void test_case_3()
{
value = 0;
- boost::fibers::spin_manual_reset_event ev( true);
+ boost::fibers::spin::manual_reset_event ev( true);
boost::fibers::scheduler<> sched;
sched.make_fiber(
@@ -129,7 +129,7 @@
void test_case_4()
{
- boost::fibers::spin_manual_reset_event ev;
+ boost::fibers::spin::manual_reset_event ev;
BOOST_CHECK_EQUAL( false, ev.try_wait() );
Modified: sandbox/fiber/libs/fiber/test/test_spin_mutex.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/test/test_spin_mutex.cpp (original)
+++ sandbox/fiber/libs/fiber/test/test_spin_mutex.cpp 2009-12-12 05:19:29 EST (Sat, 12 Dec 2009)
@@ -29,7 +29,7 @@
void operator()()
{
spin_mutex_type spin_mutex;
- boost::fibers::spin_condition condition;
+ boost::fibers::spin::condition condition;
// Test the lock's constructors.
{
@@ -49,7 +49,7 @@
void do_test_spin_mutex()
{
- test_lock< boost::fibers::spin_mutex >()();
+ test_lock< boost::fibers::spin::mutex >()();
}
void test_case1()
@@ -62,23 +62,23 @@
int value1 = 0;
int value2 = 0;
-void test_fn1( boost::fibers::spin_mutex & mtx)
+void test_fn1( boost::fibers::spin::mutex & mtx)
{
- boost::fibers::spin_mutex::scoped_lock lk( mtx);
+ boost::fibers::spin::mutex::scoped_lock lk( mtx);
++value1;
for ( int i = 0; i < 3; ++i)
boost::this_fiber::yield();
}
-void test_fn2( boost::fibers::spin_mutex & mtx)
+void test_fn2( boost::fibers::spin::mutex & mtx)
{
- boost::fibers::spin_mutex::scoped_lock lk( mtx);
+ boost::fibers::spin::mutex::scoped_lock lk( mtx);
++value2;
}
void test_case2()
{
- boost::fibers::spin_mutex mtx;
+ boost::fibers::spin::mutex mtx;
boost::fibers::scheduler<> sched;
sched.make_fiber( & test_fn1, boost::ref( mtx) );
sched.make_fiber( & test_fn2, boost::ref( mtx) );
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