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


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

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


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

示例1: killWorkerThread

 void killWorkerThread()
 {
     mRunThread = false;
     if ( mWorkerThread.joinable() )
     {
         mWorkerThread.join();
     }
 }
开发者ID:wdlindmeier,项目名称:Interferometer-Watch,代码行数:8,代码来源:ThreadedWorker.hpp

示例2: catch

 ~ThreadRunner() noexcept
     try
 {
     g_quit = true;
     if (thread_.joinable()) thread_.join();
 } catch (std::exception& e) {
     cybozu::PutLog(cybozu::LogError, "ThreadRunner: error: %s", e.what());
 }
开发者ID:walb-linux,项目名称:walb-tools,代码行数:8,代码来源:packet-repeater.cpp

示例3:

			~progressIndicatorThreadWrapper()
			{
				m_stopCondition.store( true );

				if( m_thread.joinable() )
				{
					m_thread.join();
				}
			}
开发者ID:R3AL,项目名称:PackageManager,代码行数:9,代码来源:ProgressIndicator.hpp

示例4:

  ~TetrisGame_impl()
  {
    if(runner.joinable())
      {
	gameOver();
	pauseCondition.notify_all();
	runner.join();
      }
  }
开发者ID:01d55,项目名称:UnitTestris,代码行数:9,代码来源:TetrisGame.cpp

示例5: quit

		void quit()
		{
			if (!_thread.joinable())
				return;
			_commandQueue.autoPriorityEmplace<TMQ::CloseQueue>();
			_run = false;
			_thread.join();
			_release();
		}
开发者ID:cesarl,项目名称:ThreadedCancerCells,代码行数:9,代码来源:ThreadQueue.hpp

示例6: stop

		void stop() noexcept
		{
			if( !th_.joinable() ) {
				return;
			}

			exit_flag_ = true;
			event_.set();
		}
开发者ID:LNSEAB,项目名称:mmaccel,代码行数:9,代码来源:file_monitor.cpp

示例7: QuitCommand

//--------------------------------
void QuitCommand(std::string in)
{
    UNUSED(in);
#ifdef USE_THREAD_FOR_INPUT
    if(busy || t.joinable())
        StopEngine();
#endif // USE_THREAD_FOR_INPUT

    quit = true;
}
开发者ID:niklasf,项目名称:k2,代码行数:11,代码来源:main.cpp

示例8: lock

	~Impl()
	{
		{
			std::unique_lock<std::mutex> lock(m_queueGuard);
			std::queue<Data>().swap(m_queue);
		}
		Stop();
		if (m_thread.joinable())
			m_thread.join();
	}
开发者ID:heimdallr,项目名称:home_compa_dev,代码行数:10,代码来源:ResultSaver.cpp

示例9: cleanupThread

// Helper function for cleaning up the thread in use
inline void cleanupThread(std::thread &t)
{
	if (t.joinable())
	{
		t.join();
	}
	else if (t.get_id() != std::thread::id())
	{
		t.detach();
	}
}
开发者ID:saltisgood,项目名称:XD-Input,代码行数:12,代码来源:Looper.cpp

示例10: Shutdown

void HiresTexture::Shutdown()
{
  if (s_prefetcher.joinable())
  {
    s_textureCacheAbortLoading.Set();
    s_prefetcher.join();
  }

  s_textureMap.clear();
  s_textureCache.clear();
}
开发者ID:Tinob,项目名称:Ishiiruka,代码行数:11,代码来源:HiresTextures.cpp

示例11: Shutdown

void Shutdown()
{
	// During shutdown DXGI expects us to handle some messages on the UI thread.
	// Therefore we can't immediately block and wait for the emu thread to shut
	// down, so we join the emu thread as late as possible when the UI has already
	// shut down.
	// For more info read "DirectX Graphics Infrastructure (DXGI): Best Practices"
	// on MSDN.
	if (s_emu_thread.joinable())
		s_emu_thread.join();
}
开发者ID:bullist,项目名称:dolphin,代码行数:11,代码来源:Core.cpp

示例12: StopDVDThread

static void StopDVDThread()
{
  ASSERT(s_dvd_thread.joinable());

  // By setting s_DVD_thread_exiting, we ask the DVD thread to cleanly exit.
  // In case the request queue is empty, we need to set s_request_queue_expanded
  // so that the DVD thread will wake up and check s_DVD_thread_exiting.
  s_dvd_thread_exiting.Set();
  s_request_queue_expanded.Set();

  s_dvd_thread.join();
}
开发者ID:booto,项目名称:dolphin,代码行数:12,代码来源:DVDThread.cpp

示例13: start

		void start(boost::string_ref dir, std::function< bool( boost::string_ref) >&& f)
		{
			if( th_.joinable() ) {
				return;
			}

			f_ = std::move( f );
			dir_ = winapi::directory_handle( dir, FILE_SHARE_READ, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED );
			exit_flag_ = false;

			th_ = std::thread( [this] { this->thread_main(); } );
		}
开发者ID:LNSEAB,项目名称:mmaccel,代码行数:12,代码来源:file_monitor.cpp

示例14: guard

void vc4cl::initEventQueue()
{
    std::lock_guard<std::mutex> guard(queuesMutex);
    numCommandQueues++;
    if(!eventHandler.joinable())
    {
#ifdef DEBUG_MODE
        std::cout << "[VC4CL] Starting queue handler thread..." << std::endl;
#endif
        eventHandler = std::thread(runEventQueue);
    }
}
开发者ID:SorenPrado,项目名称:VC4CL,代码行数:12,代码来源:queue_handler.cpp

示例15: IsGPUThread

bool IsGPUThread()
{
  const SConfig& _CoreParameter = SConfig::GetInstance();
  if (_CoreParameter.bCPUThread)
  {
    return (s_emu_thread.joinable() && (s_emu_thread.get_id() == std::this_thread::get_id()));
  }
  else
  {
    return IsCPUThread();
  }
}
开发者ID:CarlKenner,项目名称:dolphin,代码行数:12,代码来源:Core.cpp


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