diff options
| author | Stefan Boberg <[email protected]> | 2023-11-30 10:51:25 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-11-30 10:51:25 +0100 |
| commit | 490e383b55d0108cbee9b53e7e9cc90ad3c3f8f8 (patch) | |
| tree | be8f0d8371638fa67a7b89826ee00e2d4f49414c /src | |
| parent | global thread worker pools (#577) (diff) | |
| download | zen-490e383b55d0108cbee9b53e7e9cc90ad3c3f8f8.tar.xz zen-490e383b55d0108cbee9b53e7e9cc90ad3c3f8f8.zip | |
WinIoThreadPool teardown cleaned up (#580)
previously would not shut down the threadpool properly which would leave threads around. This was not a problem in practice for our usage since we keep the thread pool alive for the duration of the process but it's better to clean up properly.
Diffstat (limited to 'src')
| -rw-r--r-- | src/zenhttp/servers/iothreadpool.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/zenhttp/servers/iothreadpool.cpp b/src/zenhttp/servers/iothreadpool.cpp index da4b42e28..e941606e2 100644 --- a/src/zenhttp/servers/iothreadpool.cpp +++ b/src/zenhttp/servers/iothreadpool.cpp @@ -33,7 +33,12 @@ WinIoThreadPool::WinIoThreadPool(int InThreadCount, int InMaxThreadCount) WinIoThreadPool::~WinIoThreadPool() { + // this will wait for all callbacks to complete and tear down the `CreateThreadpoolIo` + // object and release all related objects + CloseThreadpoolCleanupGroupMembers(m_CleanupGroup, /* cancel pending callbacks */ TRUE, nullptr); + CloseThreadpoolCleanupGroup(m_CleanupGroup); CloseThreadpool(m_ThreadPool); + DestroyThreadpoolEnvironment(&m_CallbackEnvironment); } void |