2
0
mirror of https://github.com/boostorg/fiber.git synced 2026-02-19 14:22:23 +00:00

some modifications -> wqueue loop

This commit is contained in:
Oliver Kowalke
2013-01-17 20:04:01 +01:00
parent 80c2aa3f40
commit e28cd2c3ff
6 changed files with 24 additions and 79 deletions

View File

@@ -29,8 +29,6 @@ namespace fibers {
struct BOOST_FIBERS_DECL algorithm : private noncopyable
{
virtual void spawn( detail::fiber_base::ptr_t const&) = 0;
virtual void priority( detail::fiber_base::ptr_t const&, int) = 0;
virtual void join( detail::fiber_base::ptr_t const&) = 0;

View File

@@ -176,6 +176,17 @@ public:
flags_ &= ~flag_interruption_requested;
}
bool wake_up() const BOOST_NOEXCEPT
{ return 0 != ( flags_ & flag_wake_up); }
void wake_up( bool req) BOOST_NOEXCEPT
{
if ( req)
flags_ |= flag_wake_up;
else
flags_ &= ~flag_wake_up;
}
bool is_terminated() const BOOST_NOEXCEPT
{ return state_terminated == state_; }
@@ -228,7 +239,7 @@ public:
}
#endif
state_t previous = state_.exchange( state_ready, memory_order_seq_cst);
BOOST_ASSERT( state_waiting == previous || state_running == previous);
BOOST_ASSERT( state_waiting == previous || state_running == previous || state_ready == previous);
}
void set_running() BOOST_NOEXCEPT

View File

@@ -25,7 +25,8 @@ enum flag_t
flag_unwind_stack = 1 << 2,
flag_preserve_fpu = 1 << 3,
flag_interruption_blocked = 1 << 4,
flag_interruption_requested = 1 << 5
flag_interruption_requested = 1 << 5,
flag_wake_up = 1 << 6
};
}}}

View File

@@ -49,8 +49,6 @@ public:
~round_robin() BOOST_NOEXCEPT;
void spawn( detail::fiber_base::ptr_t const&);
void priority( detail::fiber_base::ptr_t const&, int);
void join( detail::fiber_base::ptr_t const&);