Skip to content
Snippets Groups Projects
Commit a1b862af authored by Sergey Linev's avatar Sergey Linev Committed by Axel Naumann
Browse files

http: correctly cleanup ws engine

if sender thread was started, one have to call join it - even when
thread function was normally returned
parent 00782bd0
No related branches found
No related tags found
No related merge requests found
......@@ -35,13 +35,6 @@ THttpLongPollEngine::THttpLongPollEngine(bool raw) : THttpWSEngine(), fRaw(raw)
{
}
//////////////////////////////////////////////////////////////////////////
/// destructor
THttpLongPollEngine::~THttpLongPollEngine()
{
}
//////////////////////////////////////////////////////////////////////////
/// returns ID of the engine, created from this pointer
......
......@@ -36,7 +36,7 @@ protected:
public:
THttpLongPollEngine(bool raw = false);
virtual ~THttpLongPollEngine();
virtual ~THttpLongPollEngine() = default;
UInt_t GetId() const override;
......
......@@ -32,7 +32,7 @@ private:
bool fDisabled{false}; ///<! true shortly before cleanup, set under locked fMutex from WSHandler
std::thread fSendThrd; ///<! dedicated thread for all send operations
bool fHasSendThrd{false}; ///<! if any special thread was started
bool fHasSendThrd{false}; ///<! if thread was started one have to call join method for it
std::mutex fCondMutex; ///<! mutex used to access condition
std::condition_variable fCond; ///<! condition used to sync with sending thread
......@@ -52,7 +52,7 @@ protected:
virtual Bool_t CanSendDirectly() { return kTRUE; }
public:
virtual ~THttpWSEngine() {}
virtual ~THttpWSEngine() = default;
virtual UInt_t GetId() const = 0;
......
......@@ -84,7 +84,8 @@ THttpWSHandler::~THttpWSHandler()
{
std::lock_guard<std::mutex> grd(fMutex);
clr = std::move(fEngines);
for (auto &eng : fEngines)
clr.emplace_back(std::move(eng));
}
for (auto &eng : clr) {
......@@ -301,7 +302,6 @@ Int_t THttpWSHandler::RunSendingThrd(std::shared_ptr<THttpWSEngine> engine)
std::unique_lock<std::mutex> lk(engine->fCondMutex);
engine->fCond.wait(lk);
}
engine->fHasSendThrd = false; // if thread exit - mark this
});
engine->fSendThrd.swap(thrd);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment