From e9e9fd7c3f12bc5119b567ad37527d777859dbc0 Mon Sep 17 00:00:00 2001 From: sapier Date: Tue, 3 Dec 2013 23:32:03 +0100 Subject: Replace SimpleThread by JThread now implementing same features --- src/httpfetch.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/httpfetch.cpp') diff --git a/src/httpfetch.cpp b/src/httpfetch.cpp index 64e77bc54..12e203ef2 100644 --- a/src/httpfetch.cpp +++ b/src/httpfetch.cpp @@ -319,7 +319,7 @@ struct HTTPFetchOngoing } }; -class CurlFetchThread : public SimpleThread +class CurlFetchThread : public JThread { protected: enum RequestType { @@ -539,7 +539,6 @@ protected: void * Thread() { - ThreadStarted(); log_register_thread("CurlFetchThread"); DSTACK(__FUNCTION_NAME); @@ -553,7 +552,7 @@ protected: assert(m_all_ongoing.empty()); - while (getRun()) { + while (!StopRequested()) { BEGIN_DEBUG_EXCEPTION_HANDLER /* @@ -641,9 +640,9 @@ void httpfetch_cleanup() { verbosestream<<"httpfetch_cleanup: cleaning up"<setRun(false); + g_httpfetch_thread->Stop(); g_httpfetch_thread->requestWakeUp(); - g_httpfetch_thread->stop(); + g_httpfetch_thread->Wait(); delete g_httpfetch_thread; curl_global_cleanup(); @@ -652,8 +651,6 @@ void httpfetch_cleanup() void httpfetch_async(const HTTPFetchRequest &fetchrequest) { g_httpfetch_thread->requestFetch(fetchrequest); - if (!g_httpfetch_thread->IsRunning()) - g_httpfetch_thread->Start(); } static void httpfetch_request_clear(unsigned long caller) -- cgit v1.2.3