diff --git a/UnitTests/UnitTests.vcxproj b/UnitTests/UnitTests.vcxproj
index 33eac273d..5bbbf4303 100644
--- a/UnitTests/UnitTests.vcxproj
+++ b/UnitTests/UnitTests.vcxproj
@@ -124,6 +124,7 @@
Create
+
diff --git a/UnitTests/UnitTests.vcxproj.filters b/UnitTests/UnitTests.vcxproj.filters
index 69db57137..48ea9a45d 100644
--- a/UnitTests/UnitTests.vcxproj.filters
+++ b/UnitTests/UnitTests.vcxproj.filters
@@ -42,6 +42,9 @@
Source Files
+
+ Source Files
+
diff --git a/UnitTests/pch.hpp b/UnitTests/pch.hpp
index 7e9a3ad0b..830b74348 100644
--- a/UnitTests/pch.hpp
+++ b/UnitTests/pch.hpp
@@ -16,10 +16,12 @@
#include
#include
#include
+#include
#include
#include
#include
#include
+#include
#include
#include
#include
@@ -32,4 +34,5 @@
#include
#include
+#include
#include
diff --git a/UnitTests/pool.cpp b/UnitTests/pool.cpp
new file mode 100644
index 000000000..2bda06e1c
--- /dev/null
+++ b/UnitTests/pool.cpp
@@ -0,0 +1,42 @@
+/*
+ SPDX-License-Identifier: MIT
+ Copyright © 2023 Amebis
+*/
+
+#include "pch.hpp"
+
+using namespace std;
+#ifdef _WIN32
+using namespace Microsoft::VisualStudio::CppUnitTestFramework;
+#endif
+
+namespace UnitTests
+{
+ constexpr size_t capacity = 50;
+
+ TEST_CLASS(pool)
+ {
+ public:
+ TEST_METHOD(test)
+ {
+ using worker_t = unique_ptr;
+ using pool_t = stdex::pool;
+ pool_t pool;
+ list workers;
+ for (auto n = thread::hardware_concurrency(); n--; ) {
+ workers.push_back(std::move(thread([](_Inout_ pool_t& pool)
+ {
+ for (size_t n = 10000; n--; ) {
+ worker_t el = move(pool.pop());
+ if (!el)
+ el.reset(new int(1));
+ pool.push(move(el));
+ }
+ }, ref(pool))));
+ }
+
+ for (auto& w : workers)
+ w.join();
+ }
+ };
+}
diff --git a/include/stdex/pool.hpp b/include/stdex/pool.hpp
new file mode 100644
index 000000000..51dd57c7c
--- /dev/null
+++ b/include/stdex/pool.hpp
@@ -0,0 +1,91 @@
+/*
+ SPDX-License-Identifier: MIT
+ Copyright © 2023 Amebis
+*/
+
+#pragma once
+
+#include "compat.hpp"
+#include "spinlock.hpp"
+#include "windows.h"
+#include
+#include