2
0
mirror of https://github.com/boostorg/fiber.git synced 2026-02-15 00:52:34 +00:00
This commit is contained in:
Oliver Kowalke
2013-01-27 10:14:15 +01:00
parent 007f259780
commit 0abfc511bb
10 changed files with 69 additions and 64 deletions

View File

@@ -71,7 +71,7 @@ fiber_base::release()
// so they can be resumed
// protect against concurrent access to joining_
unique_lock< spinlock > lk( joining_mtx_);
BOOST_FOREACH( fiber_base::ptr_t & p, joining_)
BOOST_FOREACH( fiber_base::ptr_t p, joining_)
{
std::stringstream ss;
ss << p->get_id();

View File

@@ -25,8 +25,8 @@ namespace boost {
namespace fibers {
void
fiber::spawn_( detail::fiber_base::ptr_t const& f)
{ detail::scheduler::instance().add( f); }
fiber::spawn_( fiber & f)
{ detail::scheduler::instance().migrate_to( f); }
int
fiber::priority() const

View File

@@ -34,7 +34,7 @@ mutex::lock()
{
while ( LOCKED == state_.exchange( LOCKED, memory_order_seq_cst) )
{
if ( ! this_fiber::is_fiberized() ) ::abort();
BOOST_ASSERT( this_fiber::is_fiberized() );
unique_lock< detail::spinlock > lk( waiting_mtx_);
waiting_.push_back(

View File

@@ -54,16 +54,6 @@ round_robin::~round_robin()
#endif
}
void
round_robin::add( detail::fiber_base::ptr_t const& f)
{
BOOST_ASSERT( f);
BOOST_ASSERT( ! f->is_running() );
BOOST_ASSERT( ! f->is_terminated() );
wqueue_.push_back( f);
}
bool
round_robin::run()
{
@@ -228,9 +218,14 @@ round_robin::priority( detail::fiber_base::ptr_t const& f, int prio)
}
void
round_robin::migrate_to( BOOST_RV_REF( fiber) f)
round_robin::migrate_to( fiber const& f_)
{
add( detail::scheduler::extract( f) );
detail::fiber_base::ptr_t f = detail::scheduler::extract( f_);
BOOST_ASSERT( f);
BOOST_ASSERT( ! f->is_running() );
BOOST_ASSERT( ! f->is_terminated() );
wqueue_.push_back( f);
}
fiber