yhirose/cpp-httplib

Behaviour when number of threads are exceeded.

marcovc opened this issue · 2 comments

Hi,

Thanks for your libray. Sorry for the basic question, but I would like to know what happens to a request if all configured threads are still serving their corresponding requests. Will that request be dropped, or will it be maintained in some queue until one of the threads becomes available for processing?

Thanks!

@marcovc it's up to a TaskQueue implementation given. As a default, it will use ThreadPool which is a simple thread pool implementation.

class ThreadPool : public TaskQueue {

If all the threads are in use, the request will wait until any thread becomes available.

You can make your own TaskQueue to control request queuing behavior as described in the following section in README.
https://github.com/yhirose/cpp-httplib#default-thread-pool-support

Thanks!