[prev in list] [next in list] [prev in thread] [next in thread] 

List:       boost-commit
Subject:    [Boost-commit] svn:boost r83648 - in trunk: boost/thread libs/thread/example
From:       vicente.botet () wanadoo ! fr
Date:       2013-03-30 14:33:43
Message-ID: 20130330143343.679AE2F8134 () wowbagger ! osl ! iu ! edu
[Download RAW message or body]

Author: viboes
Date: 2013-03-30 10:33:42 EDT (Sat, 30 Mar 2013)
New Revision: 83648
URL: http://svn.boost.org/trac/boost/changeset/83648

Log:
Thread: replace wait_and_ope by ope in sync_queues and pop by pull.
Text files modified: 
   trunk/boost/thread/sync_bounded_queue.hpp               |    84 \
++++++++++++++---------------             trunk/boost/thread/sync_queue.hpp           \
|   112 +++++++++++++++++----------------------   \
trunk/libs/thread/example/not_interleaved.cpp           |     8 +-                    \
  trunk/libs/thread/example/producer_consumer.cpp         |    16 ++--                \
  trunk/libs/thread/example/producer_consumer_bounded.cpp |    16 ++--                \
  5 files changed, 111 insertions(+), 125 deletions(-)

Modified: trunk/boost/thread/sync_bounded_queue.hpp
==============================================================================
--- trunk/boost/thread/sync_bounded_queue.hpp	(original)
+++ trunk/boost/thread/sync_bounded_queue.hpp	2013-03-30 10:33:42 EDT (Sat, 30 Mar \
2013) @@ -40,9 +40,8 @@
     typedef ValueType value_type;
     typedef std::size_t size_type;
 
-
+    // Constructors/Assignment/Destructors
     BOOST_THREAD_NO_COPYABLE(sync_bounded_queue)
-
     explicit sync_bounded_queue(size_type max_elems);
     template <typename Range>
     sync_bounded_queue(size_type max_elems, Range range);
@@ -56,25 +55,24 @@
     bool closed() const;
 
     // Modifiers
-    void wait_and_push(const value_type& x);
-    void wait_and_push(BOOST_THREAD_RV_REF(value_type) x);
+    void close();
+
+    void push(const value_type& x);
+    void push(BOOST_THREAD_RV_REF(value_type) x);
     bool try_push(const value_type& x);
     bool try_push(BOOST_THREAD_RV_REF(value_type) x);
     bool try_push(no_block_tag, const value_type& x);
     bool try_push(no_block_tag, BOOST_THREAD_RV_REF(value_type) x);
 
-    void wait_and_pop(value_type&);
-    void wait_and_pop(ValueType& elem, bool & closed);
-
-    // enable_if is_nothrow_movable<value_type>
-    value_type value_pop();
-    shared_ptr<ValueType> wait_and_pop();
-
-    bool try_pop(value_type&);
-    bool try_pop(no_block_tag,value_type&);
-    shared_ptr<ValueType> try_pop();
-
-    void close();
+    // Observers/Modifiers
+    void pull(value_type&);
+    void pull(ValueType& elem, bool & closed);
+    // enable_if is_nothrow_copy_movable<value_type>
+    value_type pull();
+    shared_ptr<ValueType> ptr_pull();
+    bool try_pull(value_type&);
+    bool try_pull(no_block_tag,value_type&);
+    shared_ptr<ValueType> try_pull();
 
   private:
     mutable mutex mtx_;
@@ -112,10 +110,10 @@
 
     void throw_if_closed(unique_lock<mutex>&);
 
-    bool try_pop(value_type& x, unique_lock<mutex>& lk);
+    bool try_pull(value_type& x, unique_lock<mutex>& lk);
     bool try_push(const value_type& x, unique_lock<mutex>& lk);
     bool try_push(BOOST_THREAD_RV_REF(value_type) x, unique_lock<mutex>& lk);
-    shared_ptr<value_type> try_pop(unique_lock<mutex>& lk);
+    shared_ptr<value_type> try_pull(unique_lock<mutex>& lk);
 
     void wait_until_not_empty(unique_lock<mutex>& lk);
     void wait_until_not_empty(unique_lock<mutex>& lk, bool&);
@@ -142,13 +140,13 @@
       }
     }
 
-    void pop(value_type& elem, unique_lock<mutex>& lk)
+    void pull(value_type& elem, unique_lock<mutex>& lk)
     {
       elem = boost::move(data_[out_]);
       out_ = inc(out_);
       notify_not_full_if_needed(lk);
     }
-    boost::shared_ptr<value_type> pop(unique_lock<mutex>& lk)
+    boost::shared_ptr<value_type> ptr_pull(unique_lock<mutex>& lk)
     {
       shared_ptr<value_type> res = \
make_shared<value_type>(boost::move(data_[out_]));  out_ = inc(out_);
@@ -265,34 +263,34 @@
 
 
   template <typename ValueType>
-  bool sync_bounded_queue<ValueType>::try_pop(ValueType& elem, unique_lock<mutex>& \
lk) +  bool sync_bounded_queue<ValueType>::try_pull(ValueType& elem, \
unique_lock<mutex>& lk)  {
     if (empty(lk))
     {
       throw_if_closed(lk);
       return false;
     }
-    pop(elem, lk);
+    pull(elem, lk);
     return true;
   }
   template <typename ValueType>
-  shared_ptr<ValueType> sync_bounded_queue<ValueType>::try_pop(unique_lock<mutex>& \
lk) +  shared_ptr<ValueType> \
sync_bounded_queue<ValueType>::try_pull(unique_lock<mutex>& lk)  {
     if (empty(lk))
     {
       throw_if_closed(lk);
       return shared_ptr<ValueType>();
     }
-    return pop(lk);
+    return ptr_pull(lk);
   }
 
   template <typename ValueType>
-  bool sync_bounded_queue<ValueType>::try_pop(ValueType& elem)
+  bool sync_bounded_queue<ValueType>::try_pull(ValueType& elem)
   {
     try
     {
       unique_lock<mutex> lk(mtx_);
-      return try_pop(elem, lk);
+      return try_pull(elem, lk);
     }
     catch (...)
     {
@@ -302,7 +300,7 @@
   }
 
   template <typename ValueType>
-  bool sync_bounded_queue<ValueType>::try_pop(no_block_tag,ValueType& elem)
+  bool sync_bounded_queue<ValueType>::try_pull(no_block_tag,ValueType& elem)
   {
     try
     {
@@ -311,7 +309,7 @@
       {
         return false;
       }
-      return try_pop(elem, lk);
+      return try_pull(elem, lk);
     }
     catch (...)
     {
@@ -320,12 +318,12 @@
     }
   }
   template <typename ValueType>
-  boost::shared_ptr<ValueType> sync_bounded_queue<ValueType>::try_pop()
+  boost::shared_ptr<ValueType> sync_bounded_queue<ValueType>::try_pull()
   {
     try
     {
       unique_lock<mutex> lk(mtx_);
-      return try_pop(lk);
+      return try_pull(lk);
     }
     catch (...)
     {
@@ -367,13 +365,13 @@
   }
 
   template <typename ValueType>
-  void sync_bounded_queue<ValueType>::wait_and_pop(ValueType& elem)
+  void sync_bounded_queue<ValueType>::pull(ValueType& elem)
   {
     try
     {
       unique_lock<mutex> lk(mtx_);
       wait_until_not_empty(lk);
-      pop(elem, lk);
+      pull(elem, lk);
     }
     catch (...)
     {
@@ -382,14 +380,14 @@
     }
   }
   template <typename ValueType>
-  void sync_bounded_queue<ValueType>::wait_and_pop(ValueType& elem, bool & closed)
+  void sync_bounded_queue<ValueType>::pull(ValueType& elem, bool & closed)
   {
     try
     {
       unique_lock<mutex> lk(mtx_);
       wait_until_not_empty(lk, closed);
       if (closed) {return;}
-      pop(elem, lk);
+      pull(elem, lk);
     }
     catch (...)
     {
@@ -400,12 +398,12 @@
 
   // enable if ValueType is nothrow movable
   template <typename ValueType>
-  ValueType sync_bounded_queue<ValueType>::value_pop()
+  ValueType sync_bounded_queue<ValueType>::pull()
   {
     try
     {
       value_type elem;
-      wait_and_pop(elem);
+      pull(elem);
       return boost::move(elem);
     }
     catch (...)
@@ -415,13 +413,13 @@
     }
   }
   template <typename ValueType>
-  boost::shared_ptr<ValueType> sync_bounded_queue<ValueType>::wait_and_pop()
+  boost::shared_ptr<ValueType> sync_bounded_queue<ValueType>::ptr_pull()
   {
     try
     {
       unique_lock<mutex> lk(mtx_);
       wait_until_not_empty(lk);
-      return pop(lk);
+      return ptr_pull(lk);
     }
     catch (...)
     {
@@ -492,7 +490,7 @@
   }
 
   template <typename ValueType>
-  void sync_bounded_queue<ValueType>::wait_and_push(const ValueType& elem)
+  void sync_bounded_queue<ValueType>::push(const ValueType& elem)
   {
     try
     {
@@ -554,7 +552,7 @@
   }
 
   template <typename ValueType>
-  void sync_bounded_queue<ValueType>::wait_and_push(BOOST_THREAD_RV_REF(ValueType) \
elem) +  void sync_bounded_queue<ValueType>::push(BOOST_THREAD_RV_REF(ValueType) \
elem)  {
     try
     {
@@ -571,21 +569,21 @@
   template <typename ValueType>
   sync_bounded_queue<ValueType>& operator<<(sync_bounded_queue<ValueType>& sbq, \
BOOST_THREAD_RV_REF(ValueType) elem)  {
-    sbq.wait_and_push(boost::forward<ValueType>(elem));
+    sbq.push(boost::forward<ValueType>(elem));
     return sbq;
   }
 
   template <typename ValueType>
   sync_bounded_queue<ValueType>& operator<<(sync_bounded_queue<ValueType>& sbq, \
ValueType const&elem)  {
-    sbq.wait_and_push(elem);
+    sbq.push(elem);
     return sbq;
   }
 
   template <typename ValueType>
   sync_bounded_queue<ValueType>& operator>>(sync_bounded_queue<ValueType>& sbq, \
ValueType &elem)  {
-    sbq.wait_and_pop(elem);
+    sbq.pull(elem);
     return sbq;
   }
 

Modified: trunk/boost/thread/sync_queue.hpp
==============================================================================
--- trunk/boost/thread/sync_queue.hpp	(original)
+++ trunk/boost/thread/sync_queue.hpp	2013-03-30 10:33:42 EDT (Sat, 30 Mar 2013)
@@ -35,12 +35,11 @@
     typedef ValueType value_type;
     typedef std::size_t size_type;
 
-
+    // Constructors/Assignment/Destructors
     BOOST_THREAD_NO_COPYABLE(sync_queue)
-
-    explicit sync_queue();
+    sync_queue();
     template <typename Range>
-    sync_queue(Range range);
+    explicit sync_queue(Range range);
     ~sync_queue();
 
     // Observers
@@ -50,25 +49,25 @@
     bool closed() const;
 
     // Modifiers
-    void wait_and_push(const value_type& x);
-    void wait_and_push(BOOST_THREAD_RV_REF(value_type) x);
+    void close();
+
+    void push(const value_type& x);
+    void push(BOOST_THREAD_RV_REF(value_type) x);
     bool try_push(const value_type& x);
     bool try_push(BOOST_THREAD_RV_REF(value_type) x);
     bool try_push(no_block_tag, const value_type& x);
     bool try_push(no_block_tag, BOOST_THREAD_RV_REF(value_type) x);
 
-    void wait_and_pop(value_type&);
-    void wait_and_pop(ValueType& elem, bool & closed);
+    // Observers/Modifiers
+    void pull(value_type&);
+    void pull(ValueType& elem, bool & closed);
+    // enable_if is_nothrow_copy_movable<value_type>
+    value_type pull();
+    shared_ptr<ValueType> ptr_pull();
+    bool try_pull(value_type&);
+    bool try_pull(no_block_tag,value_type&);
+    shared_ptr<ValueType> try_pull();
 
-    // enable_if is_nothrow_movable<value_type>
-    value_type value_pop();
-    shared_ptr<ValueType> wait_and_pop();
-
-    bool try_pop(value_type&);
-    bool try_pop(no_block_tag,value_type&);
-    shared_ptr<ValueType> try_pop();
-
-    void close();
 
   private:
     mutable mutex mtx_;
@@ -77,15 +76,12 @@
     boost::container::deque<ValueType> data_;
     bool closed_;
 
-
     bool empty(unique_lock<mutex>& ) const BOOST_NOEXCEPT
     {
-      //std::cout << __LINE__ << std::endl;
       return data_.empty();
     }
     bool empty(lock_guard<mutex>& ) const BOOST_NOEXCEPT
     {
-      //std::cout << __LINE__ << std::endl;
       return data_.empty();
     }
 
@@ -96,10 +92,10 @@
 
     void throw_if_closed(unique_lock<mutex>&);
 
-    bool try_pop(value_type& x, unique_lock<mutex>& lk);
+    bool try_pull(value_type& x, unique_lock<mutex>& lk);
     bool try_push(const value_type& x, unique_lock<mutex>& lk);
     bool try_push(BOOST_THREAD_RV_REF(value_type) x, unique_lock<mutex>& lk);
-    shared_ptr<value_type> try_pop(unique_lock<mutex>& lk);
+    shared_ptr<value_type> try_pull(unique_lock<mutex>& lk);
 
     void wait_until_not_empty(unique_lock<mutex>& lk);
     void wait_until_not_empty(unique_lock<mutex>& lk, bool&);
@@ -115,25 +111,25 @@
       }
     }
 
-    void pop(value_type& elem, unique_lock<mutex>& )
+    void pull(value_type& elem, unique_lock<mutex>& )
     {
       elem = boost::move(data_.front());
       data_.pop_front();
     }
-    boost::shared_ptr<value_type> pop(unique_lock<mutex>& )
+    boost::shared_ptr<value_type> ptr_pull(unique_lock<mutex>& )
     {
       shared_ptr<value_type> res = \
make_shared<value_type>(boost::move(data_.front()));  data_.pop_front();
       return res;
     }
 
-    void push_at(const value_type& elem, unique_lock<mutex>& lk)
+    void push(const value_type& elem, unique_lock<mutex>& lk)
     {
       data_.push_back(elem);
       notify_not_empty_if_needed(lk);
     }
 
-    void push_at(BOOST_THREAD_RV_REF(value_type) elem, unique_lock<mutex>& lk)
+    void push(BOOST_THREAD_RV_REF(value_type) elem, unique_lock<mutex>& lk)
     {
       data_.push(boost::move(elem));
       notify_not_empty_if_needed(lk);
@@ -151,7 +147,7 @@
 
 //  template <typename ValueType>
 //  template <typename Range>
-//  sync_queue<ValueType>::sync_queue(size_type max_elems, Range range) :
+//  explicit sync_queue<ValueType>::sync_queue(Range range) :
 //    waiting_empty_(0), data_(), closed_(false)
 //  {
 //    try
@@ -214,34 +210,34 @@
 
 
   template <typename ValueType>
-  bool sync_queue<ValueType>::try_pop(ValueType& elem, unique_lock<mutex>& lk)
+  bool sync_queue<ValueType>::try_pull(ValueType& elem, unique_lock<mutex>& lk)
   {
     if (empty(lk))
     {
       throw_if_closed(lk);
       return false;
     }
-    pop(elem, lk);
+    pull(elem, lk);
     return true;
   }
   template <typename ValueType>
-  shared_ptr<ValueType> sync_queue<ValueType>::try_pop(unique_lock<mutex>& lk)
+  shared_ptr<ValueType> sync_queue<ValueType>::try_pull(unique_lock<mutex>& lk)
   {
     if (empty(lk))
     {
       throw_if_closed(lk);
       return shared_ptr<ValueType>();
     }
-    return pop(lk);
+    return ptr_pull(lk);
   }
 
   template <typename ValueType>
-  bool sync_queue<ValueType>::try_pop(ValueType& elem)
+  bool sync_queue<ValueType>::try_pull(ValueType& elem)
   {
     try
     {
       unique_lock<mutex> lk(mtx_);
-      return try_pop(elem, lk);
+      return try_pull(elem, lk);
     }
     catch (...)
     {
@@ -251,7 +247,7 @@
   }
 
   template <typename ValueType>
-  bool sync_queue<ValueType>::try_pop(no_block_tag,ValueType& elem)
+  bool sync_queue<ValueType>::try_pull(no_block_tag,ValueType& elem)
   {
     try
     {
@@ -260,7 +256,7 @@
       {
         return false;
       }
-      return try_pop(elem, lk);
+      return try_pull(elem, lk);
     }
     catch (...)
     {
@@ -269,12 +265,12 @@
     }
   }
   template <typename ValueType>
-  boost::shared_ptr<ValueType> sync_queue<ValueType>::try_pop()
+  boost::shared_ptr<ValueType> sync_queue<ValueType>::try_pull()
   {
     try
     {
       unique_lock<mutex> lk(mtx_);
-      return try_pop(lk);
+      return try_pull(lk);
     }
     catch (...)
     {
@@ -286,10 +282,8 @@
   template <typename ValueType>
   void sync_queue<ValueType>::throw_if_closed(unique_lock<mutex>&)
   {
-    //std::cout << __LINE__ << std::endl;
     if (closed_)
     {
-      std::cout << __LINE__ << std::endl;
       BOOST_THROW_EXCEPTION( sync_queue_is_closed() );
     }
   }
@@ -299,10 +293,7 @@
   {
     for (;;)
     {
-      //std::cout << __LINE__ << std::endl;
       if (! empty(lk)) break;
-      //std::cout << __LINE__ << std::endl;
-
       throw_if_closed(lk);
       ++waiting_empty_;
       not_empty_.wait(lk);
@@ -314,7 +305,6 @@
     for (;;)
     {
       if (! empty(lk)) break;
-      //std::cout << __LINE__ << std::endl;
       if (closed_) {closed=true; return;}
       ++waiting_empty_;
       not_empty_.wait(lk);
@@ -322,14 +312,13 @@
   }
 
   template <typename ValueType>
-  void sync_queue<ValueType>::wait_and_pop(ValueType& elem)
+  void sync_queue<ValueType>::pull(ValueType& elem)
   {
     try
     {
       unique_lock<mutex> lk(mtx_);
-      //std::cout << __LINE__ << std::endl;
       wait_until_not_empty(lk);
-      pop(elem, lk);
+      pull(elem, lk);
     }
     catch (...)
     {
@@ -338,15 +327,14 @@
     }
   }
   template <typename ValueType>
-  void sync_queue<ValueType>::wait_and_pop(ValueType& elem, bool & closed)
+  void sync_queue<ValueType>::pull(ValueType& elem, bool & closed)
   {
     try
     {
       unique_lock<mutex> lk(mtx_);
-      //std::cout << __LINE__ << std::endl;
       wait_until_not_empty(lk, closed);
       if (closed) {return;}
-      pop(elem, lk);
+      pull(elem, lk);
     }
     catch (...)
     {
@@ -357,12 +345,12 @@
 
   // enable if ValueType is nothrow movable
   template <typename ValueType>
-  ValueType sync_queue<ValueType>::value_pop()
+  ValueType sync_queue<ValueType>::pull()
   {
     try
     {
       value_type elem;
-      wait_and_pop(elem);
+      pull(elem);
       return boost::move(elem);
     }
     catch (...)
@@ -372,13 +360,13 @@
     }
   }
   template <typename ValueType>
-  boost::shared_ptr<ValueType> sync_queue<ValueType>::wait_and_pop()
+  boost::shared_ptr<ValueType> sync_queue<ValueType>::ptr_pull()
   {
     try
     {
       unique_lock<mutex> lk(mtx_);
       wait_until_not_empty(lk);
-      return pop(lk);
+      return ptr_pull(lk);
     }
     catch (...)
     {
@@ -391,7 +379,7 @@
   bool sync_queue<ValueType>::try_push(const ValueType& elem, unique_lock<mutex>& \
lk)  {
     throw_if_closed(lk);
-    push_at(elem, lk);
+    push(elem, lk);
     return true;
   }
 
@@ -427,13 +415,13 @@
   }
 
   template <typename ValueType>
-  void sync_queue<ValueType>::wait_and_push(const ValueType& elem)
+  void sync_queue<ValueType>::push(const ValueType& elem)
   {
     try
     {
       unique_lock<mutex> lk(mtx_);
       throw_if_closed(lk);
-      push_at(elem, lk);
+      push(elem, lk);
     }
     catch (...)
     {
@@ -446,7 +434,7 @@
   bool sync_queue<ValueType>::try_push(BOOST_THREAD_RV_REF(ValueType) elem, \
unique_lock<mutex>& lk)  {
     throw_if_closed(lk);
-    push_at(boost::forward<ValueType>(elem), lk);
+    push(boost::forward<ValueType>(elem), lk);
     return true;
   }
 
@@ -485,13 +473,13 @@
   }
 
   template <typename ValueType>
-  void sync_queue<ValueType>::wait_and_push(BOOST_THREAD_RV_REF(ValueType) elem)
+  void sync_queue<ValueType>::push(BOOST_THREAD_RV_REF(ValueType) elem)
   {
     try
     {
       unique_lock<mutex> lk(mtx_);
       throw_if_closed(lk);
-      push_at(elem, lk);
+      push(elem, lk);
     }
     catch (...)
     {
@@ -503,21 +491,21 @@
   template <typename ValueType>
   sync_queue<ValueType>& operator<<(sync_queue<ValueType>& sbq, \
BOOST_THREAD_RV_REF(ValueType) elem)  {
-    sbq.wait_and_push(boost::forward<ValueType>(elem));
+    sbq.push(boost::forward<ValueType>(elem));
     return sbq;
   }
 
   template <typename ValueType>
   sync_queue<ValueType>& operator<<(sync_queue<ValueType>& sbq, ValueType \
const&elem)  {
-    sbq.wait_and_push(elem);
+    sbq.push(elem);
     return sbq;
   }
 
   template <typename ValueType>
   sync_queue<ValueType>& operator>>(sync_queue<ValueType>& sbq, ValueType &elem)
   {
-    sbq.wait_and_pop(elem);
+    sbq.pull(elem);
     return sbq;
   }
 

Modified: trunk/libs/thread/example/not_interleaved.cpp
==============================================================================
--- trunk/libs/thread/example/not_interleaved.cpp	(original)
+++ trunk/libs/thread/example/not_interleaved.cpp	2013-03-30 10:33:42 EDT (Sat, 30 \
Mar 2013) @@ -15,7 +15,7 @@
 void use_cerr(boost::externally_locked_stream<std::ostream> &mcerr)
 {
   using namespace boost;
-  auto tf = chrono::steady_clock::now() + chrono::seconds(10);
+  chrono::steady_clock::time_point tf = chrono::steady_clock::now() + \
chrono::seconds(10);  while (chrono::steady_clock::now() < tf)
   {
     mcerr << "logging data to cerr\n";
@@ -26,7 +26,7 @@
 void use_cout(boost::externally_locked_stream<std::ostream> &mcout)
 {
   using namespace boost;
-  auto tf = chrono::steady_clock::now() + chrono::seconds(5);
+  chrono::steady_clock::time_point tf = chrono::steady_clock::now() + \
chrono::seconds(5);  while (chrono::steady_clock::now() < tf)
   {
     mcout << "logging data to cout\n";
@@ -50,8 +50,8 @@
   std::string nm;
   {
     strict_lock<recursive_mutex> lk(terminal_mutex);
-    auto& gcout = mcout.hold(lk);
-    auto& gcin = mcin.hold(lk);
+    std::ostream & gcout = mcout.hold(lk);
+    //std::istream & gcin = mcin.hold(lk);
     gcout << "Enter name: ";
     //gcin >> nm;
   }

Modified: trunk/libs/thread/example/producer_consumer.cpp
==============================================================================
--- trunk/libs/thread/example/producer_consumer.cpp	(original)
+++ trunk/libs/thread/example/producer_consumer.cpp	2013-03-30 10:33:42 EDT (Sat, 30 \
Mar 2013) @@ -19,9 +19,9 @@
   try {
     for(int i=0; ;++i)
     {
-      //sbq.wait_and_push(i);
+      //sbq.push(i);
       sbq << i;
-      mos << "wait_and_push(" << i << ") "<< sbq.size()<<"\n";
+      mos << "push(" << i << ") "<< sbq.size()<<"\n";
       this_thread::sleep_for(chrono::milliseconds(200));
     }
   }
@@ -42,9 +42,9 @@
     for(int i=0; ;++i)
     {
       int r;
-      //sbq.wait_and_pop(r);
+      //sbq.pull(r);
       sbq >> r;
-      mos << i << " wait_and_pop(" << r << ") "<< sbq.size()<<"\n";
+      mos << i << " pull(" << r << ") "<< sbq.size()<<"\n";
       this_thread::sleep_for(chrono::milliseconds(250));
     }
   }
@@ -65,9 +65,9 @@
     for(int i=0; ;++i)
     {
       int r;
-      sbq.wait_and_pop(r, closed);
+      sbq.pull(r, closed);
       if (closed) break;
-      mos << i << " wait_and_pop(" << r << ")\n";
+      mos << i << " pull(" << r << ")\n";
       this_thread::sleep_for(chrono::milliseconds(250));
     }
   }
@@ -84,9 +84,9 @@
 //    for(int i=0; ;++i)
 //    {
 //      int r;
-//      queue_op_status res = sbq.wait_and_pop(r);
+//      queue_op_status res = sbq.wait_and_pull(r);
 //      if (res==queue_op_status::closed) break;
-//      mos << i << " wait_and_pop(" << r << ")\n";
+//      mos << i << " wait_and_pull(" << r << ")\n";
 //      this_thread::sleep_for(chrono::milliseconds(250));
 //    }
 //  }

Modified: trunk/libs/thread/example/producer_consumer_bounded.cpp
==============================================================================
--- trunk/libs/thread/example/producer_consumer_bounded.cpp	(original)
+++ trunk/libs/thread/example/producer_consumer_bounded.cpp	2013-03-30 10:33:42 EDT \
(Sat, 30 Mar 2013) @@ -19,9 +19,9 @@
   try {
     for(int i=0; ;++i)
     {
-      //sbq.wait_and_push(i);
+      //sbq.push(i);
       sbq << i;
-      mos << "wait_and_push(" << i << ") "<< sbq.size()<<"\n";
+      mos << "push(" << i << ") "<< sbq.size()<<"\n";
       this_thread::sleep_for(chrono::milliseconds(200));
     }
   }
@@ -42,9 +42,9 @@
     for(int i=0; ;++i)
     {
       int r;
-      //sbq.wait_and_pop(r);
+      //sbq.pull(r);
       sbq >> r;
-      mos << i << " wait_and_pop(" << r << ") "<< sbq.size()<<"\n";
+      mos << i << " pull(" << r << ") "<< sbq.size()<<"\n";
       this_thread::sleep_for(chrono::milliseconds(250));
     }
   }
@@ -65,9 +65,9 @@
     for(int i=0; ;++i)
     {
       int r;
-      sbq.wait_and_pop(r, closed);
+      sbq.pull(r, closed);
       if (closed) break;
-      mos << i << " wait_and_pop(" << r << ")\n";
+      mos << i << " pull(" << r << ")\n";
       this_thread::sleep_for(chrono::milliseconds(250));
     }
   }
@@ -84,9 +84,9 @@
 //    for(int i=0; ;++i)
 //    {
 //      int r;
-//      queue_op_status res = sbq.wait_and_pop(r);
+//      queue_op_status res = sbq.wait_and_pull(r);
 //      if (res==queue_op_status::closed) break;
-//      mos << i << " wait_and_pop(" << r << ")\n";
+//      mos << i << " wait_and_pull(" << r << ")\n";
 //      this_thread::sleep_for(chrono::milliseconds(250));
 //    }
 //  }
_______________________________________________
Boost-commit mailing list
Boost-commit@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-commit


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic