本文整理汇总了C++中thread::detach方法的典型用法代码示例。如果您正苦于以下问题:C++ thread::detach方法的具体用法?C++ thread::detach怎么用?C++ thread::detach使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thread
的用法示例。
在下文中一共展示了thread::detach方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: shutdownRuntime
void SC_LanguageClient::shutdownRuntime()
{
cleanup_OSC();
#if __APPLE__
gResyncThread.detach(); // leak!
#endif
}
示例2: average
average(){
sum = 0;
delete_thread_run = true;
life = chrono::seconds(10);
del = thread(&average::deleteOldData, this);
if(del.joinable()) del.detach();
}
示例3: StopReceivingMessages
void StopReceivingMessages()
{
if (SetEvent(stopRunning)) {
messageThread.join();
} else {
cerr << "SetEvent failed: " << GetLastError() << "\n";
messageThread.detach();
}
}
示例4: init
void init(void)
{
if (currentStage != Stage::NOT_INITIALIZED)
throw ShmemAlreadyInitializedException();
shmemBuffer = new char[SHMEM_BUF_SIZE];
strncpy(shmemBuffer, "INIT", SHMEM_BUF_SIZE);
agentThread = thread(agent);
agentThread.detach();
while (!isMsgEqualTo("ACK"));
currentStage = Stage::ACTIVE;
}
示例5: startSim
void startSim(int* common,int hold1,int hold2,int playerNum,SimType type)
{
stopAndGetRes();
while(running.load())
{
this_thread::sleep_for(std::chrono::milliseconds(2));
}
std::lock_guard<std::mutex> lck (mtx);
sum=win=0;
stop=false;
simThread=move(thread(work,this,common,(int)type,hold1,hold2,playerNum));
simThread.detach();
}
示例6: operator
void operator()(thread& t)
{
t.detach();
}
示例7: detach
void detach() {
_thread.detach();
}