feat(util/thread): handle thread creation/join failure on Windows
This commit is contained in:
parent
612cde33b6
commit
c77a987b4d
1 changed files with 6 additions and 1 deletions
|
|
@ -45,10 +45,15 @@ struct lthread::imp {
|
|||
m_proc(p) {
|
||||
m_thread = CreateThread(nullptr, m_thread_stack_size,
|
||||
_main, &m_proc, 0, nullptr);
|
||||
if (m_thread == NULL) {
|
||||
throw exception("failed to create thread");
|
||||
}
|
||||
}
|
||||
|
||||
void join() {
|
||||
WaitForSingleObject(m_thread, INFINITE);
|
||||
if (WaitForSingleObject(m_thread, INFINITE) == WAIT_FAILED) {
|
||||
throw exception("failed to join thread");
|
||||
}
|
||||
}
|
||||
};
|
||||
#else
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue