D++ (DPP)
C++ Discord API Bot Library
dpp::in_thread Class Reference

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...

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ in_thread()

dpp::in_thread::in_thread ( class cluster owner,
class request_queue req_q,
uint32_t  index 
)

Construct a new in thread object.

Parameters
ownerOwning cluster
req_qOwning request queue
indexThread index number

◆ ~in_thread()

dpp::in_thread::~in_thread ( )

Destroy the in thread object This will end the thread that is owned by this object by joining it.

Member Function Documentation

◆ post_request()

void dpp::in_thread::post_request ( std::unique_ptr< http_request req)

Post a http_request to this thread.

Parameters
reqhttp_request to post. The pointer will be freed when it has been executed.

◆ terminate()

void dpp::in_thread::terminate ( )

Terminates the thread This will end the thread that is owned by this object, but will not join it.

D++ Library version 9.0.13D++ Library version 9.0.12D++ Library version 9.0.11D++ Library version 9.0.10D++ Library version 9.0.9D++ Library version 9.0.8D++ Library version 9.0.7D++ Library version 9.0.6D++ Library version 9.0.5D++ Library version 9.0.4D++ Library version 9.0.3D++ Library version 9.0.2D++ Library version 9.0.1D++ Library version 9.0.0D++ Library version 1.0.2D++ Library version 1.0.1D++ Library version 1.0.0