当前位置: 首页>>代码示例>>C++>>正文


C++ thread::get_id方法代码示例

本文整理汇总了C++中boost::thread::get_id方法的典型用法代码示例。如果您正苦于以下问题:C++ thread::get_id方法的具体用法?C++ thread::get_id怎么用?C++ thread::get_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在boost::thread的用法示例。


在下文中一共展示了thread::get_id方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: shutdown

void shutdown()
{
  boost::recursive_mutex::scoped_lock lock(g_shutting_down_mutex);
  // gracefully return if we've not fired ros up yet, or mid-shutdown
  if (g_shutting_down || !g_initialized)
  {
    return;
  }

  ROSCPP_LOG_DEBUG("Shutting down roscpp");

  g_shutting_down = true;

  g_global_queue->disable();
  g_global_queue->clear();

  if (g_internal_queue_thread.get_id() != boost::this_thread::get_id())
  {
    g_internal_queue_thread.join();
  }

  const log4cxx::LoggerPtr& logger = log4cxx::Logger::getLogger(ROSCONSOLE_ROOT_LOGGER_NAME);
  logger->removeAppender(g_rosout_appender);
  g_rosout_appender = 0;

  // reset this so that the logger doesn't get crashily destroyed
  // again during global destruction.  
  //
  // See https://code.ros.org/trac/ros/ticket/3271
  //
  log4cxx::Logger::getRootLogger()->getLoggerRepository()->shutdown();
  log4cxx::LoggerPtr& fo_logger = ros::file_log::getFileOnlyLogger();
  fo_logger = log4cxx::LoggerPtr();
  
  if (g_started)
  {
    TopicManager::instance()->shutdown();
    ServiceManager::instance()->shutdown();
    PollManager::instance()->shutdown();
    ConnectionManager::instance()->shutdown();
    XMLRPCManager::instance()->shutdown();
  }

  WallTime end = WallTime::now();

  ROSCPP_LOG_DEBUG("Shutdown finished");

  g_started = false;
  g_ok = false;
  Time::shutdown();
}
开发者ID:robotambassador,项目名称:robot-ambassadors,代码行数:51,代码来源:init.cpp

示例2: catch

void nuke_ms::clientnode::catchThread(boost::thread& thread, unsigned threadwait_ms)
{
    // a thread id that compares equal to "not-a-thread"
    boost::thread::id not_a_thread;

    try {
        // give the thread a few seconds time to join
        thread.timed_join(boost::posix_time::millisec(threadwait_ms));
    }
    catch(...)
    {}

    // if the thread finished, return. otherwise try to kill the thread
    if (thread.get_id() == not_a_thread)
        return;

    thread.interrupt();

    // if it is still running, let it go
    if (thread.get_id() == not_a_thread)
        return;

    thread.detach();
}
开发者ID:fat-lobyte,项目名称:nuke-ms,代码行数:24,代码来源:clientnode.cpp

示例3: id

	// --------------------------------------------------------------
	/// This object's thread ID, or Not-any-thread if the thread is not running.
	/// @return - if this object refers to a thread of execution, an
	/// instance of boost::thread::id that represents this thread is
	/// returned. Otherwise, a default-constructed boost::thread::id
	/// is returned (and if you insert it into a stream, 
	/// you'll get '{Not-any-thread}').
	boost::thread::id id() const {
		return _thread.get_id();
	}
开发者ID:hbellur,项目名称:MTL,代码行数:10,代码来源:BaseThread.hpp

示例4: GetThreadID

 string GetThreadID(){
     return Conv::ToString(m_Thread.get_id());
 }
开发者ID:str0g,项目名称:LittleBenchmark,代码行数:3,代码来源:myThreadTemplates.hpp


注:本文中的boost::thread::get_id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。