diff --git a/src/util/thread.cpp b/src/util/thread.cpp index 0d8a20e59b..e96395eada 100644 --- a/src/util/thread.cpp +++ b/src/util/thread.cpp @@ -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