mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-02 19:19:41 +01:00
http: replace WorkQueue and threads handling for ThreadPool
Replace the HTTP server's WorkQueue implementation and single threads handling code with ThreadPool for processing HTTP requests. The ThreadPool class encapsulates all this functionality on a reusable class, properly unit and fuzz tested (the previous code was not unit nor fuzz tested at all). This cleanly separates responsibilities: The HTTP server now focuses solely on receiving and dispatching requests, while ThreadPool handles concurrency, queuing, and execution. It simplifies init, shutdown and requests tracking. This also allows us to experiment with further performance improvements at the task queuing and execution level, such as a lock-free structure, task prioritization or any other performance improvement in the future, without having to deal with HTTP code that lives on a different layer.
This commit is contained in:
@@ -159,15 +159,6 @@ public:
|
||||
*/
|
||||
std::optional<std::string> GetQueryParameterFromUri(const char* uri, const std::string& key);
|
||||
|
||||
/** Event handler closure.
|
||||
*/
|
||||
class HTTPClosure
|
||||
{
|
||||
public:
|
||||
virtual void operator()() = 0;
|
||||
virtual ~HTTPClosure() = default;
|
||||
};
|
||||
|
||||
/** Event class. This can be used either as a cross-thread trigger or as a timer.
|
||||
*/
|
||||
class HTTPEvent
|
||||
|
||||
Reference in New Issue
Block a user