add http_client library, using libcurl
take out common http entities to http_common dir
This commit is contained in:
32
libs/http_client/curl_thread_pool_p.h
Normal file
32
libs/http_client/curl_thread_pool_p.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef curl_thread_pool_p_H
|
||||
#define curl_thread_pool_p_H
|
||||
|
||||
#include "piconditionvar.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
|
||||
Reference in New Issue
Block a user