32 lines
561 B
C++
32 lines
561 B
C++
#ifndef curl_thread_pool_p_H
|
|
#define curl_thread_pool_p_H
|
|
|
|
#include "piprotectedvariable.h"
|
|
#include "pisemaphore.h"
|
|
#include "pithread.h"
|
|
|
|
class PIHTTPClient;
|
|
|
|
class CurlThreadPool {
|
|
public:
|
|
void registerClient(PIHTTPClient * c);
|
|
|
|
static CurlThreadPool * instance();
|
|
|
|
private:
|
|
NO_COPY_CLASS(CurlThreadPool)
|
|
CurlThreadPool();
|
|
~CurlThreadPool();
|
|
|
|
void threadFunc();
|
|
void procClient(PIHTTPClient * c);
|
|
|
|
PIProtectedVariable<PIQueue<PIHTTPClient *>> clients;
|
|
PISemaphore sem;
|
|
PIVector<PIThread *> threads;
|
|
std::atomic_bool exiting = {false};
|
|
};
|
|
|
|
|
|
#endif
|