feat: 实现最简单线程池并通过测试

This commit is contained in:
2025-09-28 13:20:52 +00:00
parent 648ed1575a
commit 8d12ce73a0
4 changed files with 141 additions and 1 deletions
+21
View File
@@ -0,0 +1,21 @@
#include <utils/thread_pool.hpp>
int main()
{
using namespace ouc_server::utils;
ThreadPool pool(4);
auto f1 = pool.sumbit(
[]()
{ puts("Hello world from thread pool!"); });
auto f2 = pool.sumbit(
[](int a, int b)
{
return a + b;
},
1, 2);
f1.get();
printf("f2 result: %d\n", f2.get());
}