D++ (DPP)
C++ Discord API Bot Library
|
Represents a thread in the thread pool handling requests to HTTP(S) servers. There are several of these, the total defined by a constant in queues.cpp, and each one will always receive requests for the same rate limit bucket based on its endpoint portion of the url. This makes rate limit handling reliable and easy to manage. Each of these also has its own mutex, so that requests are less likely to block while waiting for internal containers to be usable. More...
#include <queues.h>
Public Member Functions | |
in_thread (class cluster *owner, class request_queue *req_q, uint32_t index) | |
Construct a new in thread object. More... | |
~in_thread () | |
Destroy the in thread object This will end the thread that is owned by this object by joining it. More... | |
void | terminate () |
Terminates the thread This will end the thread that is owned by this object, but will not join it. More... | |
void | post_request (std::unique_ptr< http_request > req) |
Post a http_request to this thread. More... | |
Represents a thread in the thread pool handling requests to HTTP(S) servers. There are several of these, the total defined by a constant in queues.cpp, and each one will always receive requests for the same rate limit bucket based on its endpoint portion of the url. This makes rate limit handling reliable and easy to manage. Each of these also has its own mutex, so that requests are less likely to block while waiting for internal containers to be usable.
dpp::in_thread::in_thread | ( | class cluster * | owner, |
class request_queue * | req_q, | ||
uint32_t | index | ||
) |
Construct a new in thread object.
owner | Owning cluster |
req_q | Owning request queue |
index | Thread index number |
dpp::in_thread::~in_thread | ( | ) |
Destroy the in thread object This will end the thread that is owned by this object by joining it.
void dpp::in_thread::post_request | ( | std::unique_ptr< http_request > | req | ) |
Post a http_request to this thread.
req | http_request to post. The pointer will be freed when it has been executed. |
void dpp::in_thread::terminate | ( | ) |
Terminates the thread This will end the thread that is owned by this object, but will not join it.