mirror of
https://github.com/boostorg/fiber.git
synced 2026-02-19 14:22:23 +00:00
remove wake_up/woke_up -> use of is_ready/set_ready instead
This commit is contained in:
@@ -94,7 +94,7 @@ public:
|
||||
lt.unlock();
|
||||
|
||||
lk.unlock();
|
||||
while ( ! n->woken_up() )
|
||||
while ( ! n->is_ready() )
|
||||
{
|
||||
fprintf(stdout, "condition: main-fiber not woken-up\n");
|
||||
// run scheduler
|
||||
|
||||
@@ -55,11 +55,11 @@ private:
|
||||
std::vector< ptr_t > joining_;
|
||||
|
||||
void add_ref() BOOST_NOEXCEPT
|
||||
{ use_count_.fetch_add( 1, memory_order_seq_cst); }
|
||||
{ ++use_count_; }
|
||||
|
||||
void release_ref()
|
||||
{
|
||||
if ( 1 == use_count_.fetch_sub( 1, memory_order_seq_cst) )
|
||||
if ( 0 == --use_count_)
|
||||
deallocate_object();
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +27,6 @@ namespace detail {
|
||||
|
||||
class notify : private noncopyable
|
||||
{
|
||||
private:
|
||||
atomic< bool > wake_up_;
|
||||
|
||||
protected:
|
||||
virtual void add_ref() BOOST_NOEXCEPT = 0;
|
||||
virtual void release_ref() = 0;
|
||||
@@ -37,17 +34,11 @@ protected:
|
||||
public:
|
||||
typedef intrusive_ptr< notify > ptr_t;
|
||||
|
||||
notify() :
|
||||
wake_up_( false)
|
||||
{}
|
||||
|
||||
virtual ~notify() {};
|
||||
|
||||
bool woken_up() BOOST_NOEXCEPT
|
||||
{ return wake_up_.exchange( false, memory_order_seq_cst); }
|
||||
virtual bool is_ready() const BOOST_NOEXCEPT = 0;
|
||||
|
||||
void wake_up() BOOST_NOEXCEPT
|
||||
{ wake_up_.exchange( true, memory_order_seq_cst); }
|
||||
virtual void set_ready() BOOST_NOEXCEPT = 0;
|
||||
|
||||
friend inline void intrusive_ptr_add_ref( notify * p) BOOST_NOEXCEPT
|
||||
{ p->add_ref(); }
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/atomic.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/chrono/system_clocks.hpp>
|
||||
#include <boost/config.hpp>
|
||||
@@ -116,7 +117,7 @@ namespace fibers {
|
||||
struct future_object_base
|
||||
{
|
||||
boost::exception_ptr exception;
|
||||
bool done;
|
||||
atomic< bool > done;
|
||||
boost::fibers::mutex mutex;
|
||||
boost::fibers::condition waiters;
|
||||
typedef std::list<boost::fibers::condition*> waiter_list;
|
||||
|
||||
Reference in New Issue
Block a user