You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-2Lines changed: 7 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -297,13 +297,18 @@ Please see [Server example](https://github.com/yhirose/cpp-httplib/blob/master/e
297
297
298
298
### Default thread pool support
299
299
300
+
`ThreadPool` is used as a **default** task queue, and the default thread count is 8, or `std::thread::hardware_concurrency()`. You can change it with `CPPHTTPLIB_THREAD_POOL_COUNT`.
300
301
301
-
`ThreadPool` is used as a default task queue, and the default thread count is set to value from `std::thread::hardware_concurrency()`.
302
+
If you want to set the thread count at runtime, there is no convenient way... But here is how.
302
303
303
-
You can change the thread count by setting `CPPHTTPLIB_THREAD_POOL_COUNT`.
304
+
```cpp
305
+
svr.new_task_queue = [] { return new ThreadPool(12); };
306
+
```
304
307
305
308
### Override the default thread pool with yours
306
309
310
+
You can supply your own thread pool implementation according to your need.
311
+
307
312
```cpp
308
313
class YourThreadPoolTaskQueue : public TaskQueue {
0 commit comments