From 0dbebac482c993385efb4a7c14e5e94ccb10a4f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Thu, 21 Sep 2017 13:38:24 +0200 Subject: [PATCH] Add TaskPool.threadCount property. --- source/vibe/core/taskpool.d | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/vibe/core/taskpool.d b/source/vibe/core/taskpool.d index 72e78c4..7e9adee 100644 --- a/source/vibe/core/taskpool.d +++ b/source/vibe/core/taskpool.d @@ -29,6 +29,7 @@ shared final class TaskPool { } vibe.core.sync.Monitor!(State, shared(SpinLock)) m_state; shared(ManualEvent) m_signal; + immutable size_t m_threadCount; } /** Creates a new task pool with the specified number of threads. @@ -40,6 +41,7 @@ shared final class TaskPool { @safe { import std.format : format; + m_threadCount = thread_count; m_signal = createSharedManualEvent(); with (m_state.lock) { @@ -57,6 +59,10 @@ shared final class TaskPool { } } + /** Returns the number of worker threads. + */ + @property size_t threadCount() const shared { return m_threadCount; } + /** Instructs all worker threads to terminate and waits until all have finished. */