Пример #1
0
  /// Stop all io_service objects, default with gracefully mode.
  void stop(bool force = false)
  {
    if (work_.empty())
      return;

    {
      // Lock for synchronize access to data.
      scoped_lock_t lock(mutex_);

      // Allow all operations and handlers to be finished normally,
      //   the work object may be explicitly destroyed.
      for (size_t i = work_.size(); i > 0 ; --i)
        work_[i - 1].reset();

      work_.clear();
    }

    // If in force mode, maybe some handlers cannot be dispatched.
    if (force)
      force_stop();

    // If in block mode, wait for all threads in the pool to exit.
    if (!blocked_)
      wait();
  }
Пример #2
0
folder_watcher::~folder_watcher()
{
	force_stop();
}