Ticket #11069: boost.2.patch

File boost.2.patch, 2.0 KB (added by dmitrmax@…, 8 years ago)

V2 version of patch. First is not correct.

  • boost/asio/detail/impl/task_io_service.ipp

    diff -uprN boost_1_55_0.orig/boost/asio/detail/impl/task_io_service.ipp boost_1_55_0.patch/boost/asio/detail/impl/task_io_service.ipp
    old new struct task_io_service::work_cleanup  
    7777    {
    7878      lock_->lock();
    7979      task_io_service_->op_queue_.push(this_thread_->private_op_queue);
     80      lock_->unlock();
    8081    }
    8182#endif // defined(BOOST_ASIO_HAS_THREADS)
     83
     84    // If the last handler put a new work into the empty queue
     85    // we should wake up a thread for it
     86    if(check_new_handlers_)
     87    {
     88      lock_->lock();
     89      if(!task_io_service_->op_queue_.empty())
     90        task_io_service_->wake_one_thread_and_unlock(*lock_);
     91      else
     92        lock_->unlock();
     93    }
    8294  }
    8395
    8496  task_io_service* task_io_service_;
    8597  mutex::scoped_lock* lock_;
    8698  thread_info* this_thread_;
     99  bool check_new_handlers_;
    87100};
    88101
    89102task_io_service::task_io_service(
    std::size_t task_io_service::do_run_one(  
    377390          lock.unlock();
    378391
    379392        // Ensure the count of outstanding work is decremented on block exit.
    380         work_cleanup on_exit = { this, &lock, &this_thread };
     393        work_cleanup on_exit = { this, &lock, &this_thread, !one_thread_ };
    381394        (void)on_exit;
    382395
    383396        // Complete the operation. May throw an exception. Deletes the object.
  • boost/asio/detail/posix_event.hpp

    diff -uprN boost_1_55_0.orig/boost/asio/detail/posix_event.hpp boost_1_55_0.patch/boost/asio/detail/posix_event.hpp
    old new public:  
    5858  {
    5959    BOOST_ASIO_ASSERT(lock.locked());
    6060    signalled_ = true;
    61     lock.unlock();
    6261    ::pthread_cond_signal(&cond_); // Ignore EINVAL.
     62    lock.unlock();
    6363  }
    6464
    6565  // Reset the event.