本文整理汇总了C++中thread::join方法的典型用法代码示例。如果您正苦于以下问题:C++ thread::join方法的具体用法?C++ thread::join怎么用?C++ thread::join使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thread
的用法示例。
在下文中一共展示了thread::join方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runnable_pair_test
void runnable_pair_test(runnable & a, runnable & b)
{
cerr << "Entering runnable_pair_test" << endl;
static thread ut1, ut2;
ut1.start(a);
ut2.start(b);
ut1.join();
ut2.join();
};
示例2:
inline IVCamSource::~IVCamSource()
{
//done using it, kill the seg_service
stopThread = true;
if (camThread.joinable()) camThread.join();
TerminateProcessByName(L"seg_service.exe");
}
示例3: operator
void operator()(thread& t)
{
if (t.joinable())
{
t.join();
}
}
示例4: execJobSync
~Actor() // <------------ PATCH
{
execJobSync([this]()->int
{
d_keepWorkerRunning = false;
return 0;
});
d_worker.join();
}
示例5: rng_finilize
void rng_finilize()
{
rng_producer_done = true;
rng_producer_thread.join();
/* Cleanup */
curandDestroyGenerator(gen);
cudaFree(devData);
}
示例6: StopReceivingMessages
void StopReceivingMessages()
{
if (SetEvent(stopRunning)) {
messageThread.join();
} else {
cerr << "SetEvent failed: " << GetLastError() << "\n";
messageThread.detach();
}
}
示例7: unload
C_LINKAGE SC_API_EXPORT void unload(InterfaceTable *inTable)
{
inputThreadRunning = false;
uiListenThread.join();
#ifndef _WIN32
if (d)
XCloseDisplay(d);
#endif
}
示例8: join
void join()
{
if(!thread_.joinable())
return;
should_stop_ = true;
thread_.join();
}
示例9: Stop
void SwitcherData::Stop()
{
if (th.joinable()) {
{
lock_guard<mutex> lock(m);
stop = true;
}
cv.notify_one();
th.join();
}
}
示例10: stop
void stop()
{
if(thread_.joinable())
{
{
lock_guard lock{m_};
stop_ = true;
}
cond_.notify_all();
thread_.join();
}
}
示例11: stop_log_rotation
void stop_log_rotation() {
// if no log rotation active, quit.
if (!thread_running) return;
// join the log rotation thread.
lock.lock();
thread_running = false;
cond.signal();
lock.unlock();
log_rotate_thread.join();
// we will continue logging to the same location, but we will
// delete the symlink
unlink(symlink_name.c_str());
}
示例12: obs_module_unload
void obs_module_unload(void)
{
#ifdef USE_QT_LOOP
BrowserShutdown();
#else
if (manager_thread.joinable()) {
while (!QueueCEFTask([] () {CefQuitMessageLoop();}))
os_sleep_ms(5);
manager_thread.join();
}
#endif
os_event_destroy(cef_started_event);
}
示例13:
JNIEXPORT jint JNICALL Java_org_iotivity_ResourceHosting_ResourceHosting_OICCoordinatorStop
(JNIEnv *env, jobject obj)
{
jint result = 0;
//terminate Thread
if (ocProcessThread.joinable())
{
threadRun = false;
ocProcessThread.join();
}
else
{
result = (jint)HOSTING_THREAD_ERROR;
return result;
}
result = (jint)OICStopCoordinate();
return result;
}
示例14: return
JNIEXPORT jint JNICALL Java_org_iotivity_ResourceHosting_ResourceHosting_ResourceHostingTerminate
(JNIEnv *env, jobject obj)
{
if (OCStop() != OC_STACK_OK)
{
return (jint)OCSTACK_ERROR;
}
//terminate Thread
if (ocProcessThread.joinable())
{
threadRun = false;
ocProcessThread.join();
}
else
{
return (jint)HOSTING_THREAD_ERROR;
}
return (jint)OCSTACK_OK;
}
示例15: stop_iocp_thread
void stop_iocp_thread()
{
CancelIo(hCom);
PostQueuedCompletionStatus (hIOCP,0,KEY_STOP,0);
io_thread.join();
}