aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/workthreadpool.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zencore/workthreadpool.cpp')
-rw-r--r--src/zencore/workthreadpool.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/zencore/workthreadpool.cpp b/src/zencore/workthreadpool.cpp
index f41c13bf6..d15fb2e83 100644
--- a/src/zencore/workthreadpool.cpp
+++ b/src/zencore/workthreadpool.cpp
@@ -3,6 +3,7 @@
#include <zencore/workthreadpool.h>
#include <zencore/blockingqueue.h>
+#include <zencore/except.h>
#include <zencore/logging.h>
#include <zencore/string.h>
#include <zencore/testing.h>
@@ -56,18 +57,33 @@ struct WorkerThreadPool::Impl
// Thread pool setup
m_ThreadPool = CreateThreadpool(NULL);
+ if (m_ThreadPool == NULL)
+ {
+ ThrowLastError("CreateThreadpool failed");
+ }
- SetThreadpoolThreadMinimum(m_ThreadPool, InThreadCount);
+ if (!SetThreadpoolThreadMinimum(m_ThreadPool, InThreadCount))
+ {
+ ThrowLastError("SetThreadpoolThreadMinimum failed");
+ }
SetThreadpoolThreadMaximum(m_ThreadPool, InThreadCount * 2);
InitializeThreadpoolEnvironment(&m_CallbackEnvironment);
m_CleanupGroup = CreateThreadpoolCleanupGroup();
+ if (m_CleanupGroup == NULL)
+ {
+ ThrowLastError("CreateThreadpoolCleanupGroup failed");
+ }
SetThreadpoolCallbackPool(&m_CallbackEnvironment, m_ThreadPool);
SetThreadpoolCallbackCleanupGroup(&m_CallbackEnvironment, m_CleanupGroup, NULL);
m_Work = CreateThreadpoolWork(&WorkCallback, this, &m_CallbackEnvironment);
+ if (m_Work == NULL)
+ {
+ ThrowLastError("CreateThreadpoolWork failed");
+ }
}
~Impl()