mirror of
https://gitee.com/openharmony/communication_netstack
synced 2024-11-27 00:51:24 +00:00
commit
ece1976f3e
@ -19,6 +19,7 @@
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
|
||||
#include "curl/curl.h"
|
||||
|
||||
@ -42,6 +43,7 @@ private:
|
||||
std::atomic_bool stop_ = false;
|
||||
std::once_flag init_;
|
||||
int sleepTimeoutMs_;
|
||||
std::thread workThread_;
|
||||
|
||||
std::shared_ptr<HttpOverCurl::ThreadSafeStorage<RequestInfo *>> incomingQueue_;
|
||||
};
|
||||
|
@ -33,6 +33,9 @@ EpollRequestHandler::EpollRequestHandler(int sleepTimeoutMs)
|
||||
EpollRequestHandler::~EpollRequestHandler()
|
||||
{
|
||||
stop_ = true;
|
||||
if (workThread_.joinable()) {
|
||||
workThread_.join();
|
||||
}
|
||||
}
|
||||
|
||||
void EpollRequestHandler::Process(CURL *easyHandle, const TransferStartedCallback &startedCallback,
|
||||
@ -50,7 +53,7 @@ void EpollRequestHandler::Process(CURL *easyHandle, const TransferStartedCallbac
|
||||
#endif
|
||||
WorkingThread();
|
||||
};
|
||||
auto workThread_ = std::thread(f);
|
||||
workThread_ = std::thread(f);
|
||||
workThread_.detach();
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user