boostorg / thread

Boost.org thread module
http://boost.org/libs/thread
198 stars 162 forks source link

boost::sync_bounded_queue wait_push_back wrong code with rvalue #289

Open Lokimed opened 5 years ago

Lokimed commented 5 years ago

lvalue code correct

  template <typename ValueType>
  queue_op_status sync_bounded_queue<ValueType>::wait_push_back(const ValueType& elem)
  {
    unique_lock<mutex> lk(mtx_);
    return wait_push_back(elem, lk);
  }

But rvalue code wrong

  template <typename ValueType>
  queue_op_status sync_bounded_queue<ValueType>::wait_push_back(BOOST_THREAD_RV_REF(ValueType) elem)
  {
      unique_lock<mutex> lk(mtx_);
      return try_push_back(boost::move(elem), lk);
  }

Instead return try_push_back(boost::move(elem), lk); must be return wait_push_back(boost::move(elem), lk);

viboes commented 4 years ago

Please, could you provide a por?

Lokimed commented 4 years ago

Hi. What you mean by word "por"? You need code example (test) which can detect problem?

viboes commented 4 years ago

Sorry a PR, pull request.

Lokimed commented 4 years ago

https://github.com/boostorg/thread/pull/292 i hope i did pull request correct.