mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-11-16 19:20:50 +00:00
Make ThreadPool idle timeout configurable at runtime (Fix #2481)
This commit is contained in:
1 parent
45da614ddd
commit
32ff75e355
3 files changed
+58
-6
No files matched your search
@@ -824,6 +824,15 @@ svr.new_task_queue = [] { return new ThreadPool(/*base_threads=*/12, /*max_threa
|
||||
Default limit is 0 (unlimited). Once the limit is reached, the listener
|
||||
will shutdown the client connection.
|
||||
|
||||
#### Idle timeout for dynamic threads
|
||||
|
||||
The idle timeout for dynamic threads can also be set at runtime via the
|
||||
fourth parameter (in seconds):
|
||||
|
||||
```cpp
|
||||
svr.new_task_queue = [] { return new ThreadPool(/*base_threads=*/8, /*max_threads=*/64, /*max_queued_requests=*/0, /*idle_timeout_sec=*/10); };
|
||||
```
|
||||
|
||||
### Override the default thread pool with yours
|
||||
|
||||
You can supply your own thread pool implementation according to your need.
|
||||
|
||||
Reference in new issue
Block a user