mirror of https://github.com/axmolengine/axmol.git
commit
0886473e1b
|
@ -367,11 +367,16 @@ namespace cocos2d { namespace network {
|
|||
void run()
|
||||
{
|
||||
lock_guard<mutex> lock(_threadMutex);
|
||||
if (!_thread.joinable())
|
||||
{
|
||||
std::thread newThread(&DownloaderCURL::Impl::_threadProc, this);
|
||||
_thread.swap(newThread);
|
||||
|
||||
if (_tasksFinished)
|
||||
{ // all tasks finished, make sure thread not joinable
|
||||
if (_thread.joinable())
|
||||
_thread.join();
|
||||
_tasksFinished = false;
|
||||
}
|
||||
|
||||
if (!_thread.joinable())
|
||||
_thread = std::thread(&DownloaderCURL::Impl::_threadProc, this);
|
||||
}
|
||||
|
||||
void stop()
|
||||
|
@ -392,12 +397,6 @@ namespace cocos2d { namespace network {
|
|||
_thread.join();
|
||||
}
|
||||
|
||||
bool stoped()
|
||||
{
|
||||
lock_guard<mutex> lock(_threadMutex);
|
||||
return !_thread.joinable();
|
||||
}
|
||||
|
||||
void getProcessTasks(vector<TaskWrapper>& outList)
|
||||
{
|
||||
lock_guard<mutex> lock(_processMutex);
|
||||
|
@ -808,11 +807,14 @@ namespace cocos2d { namespace network {
|
|||
}
|
||||
} while (!coTaskMap.empty());
|
||||
|
||||
_tasksFinished = true;
|
||||
|
||||
curl_multi_cleanup(curlmHandle);
|
||||
DLLOG("----DownloaderCURL::Impl::_threadProc end");
|
||||
}
|
||||
|
||||
thread _thread;
|
||||
std::atomic_bool _tasksFinished{};
|
||||
deque<TaskWrapper> _requestQueue;
|
||||
set<TaskWrapper> _processSet;
|
||||
// deque<TaskWrapper> _finishedQueue;
|
||||
|
|
|
@ -31,8 +31,8 @@ THE SOFTWARE.
|
|||
|
||||
#include "base/CCConsole.h"
|
||||
|
||||
//#define CC_DOWNLOADER_DEBUG
|
||||
#ifdef CC_DOWNLOADER_DEBUG
|
||||
// #define CC_DOWNLOADER_DEBUG
|
||||
#if defined(CC_DOWNLOADER_DEBUG) || defined(_DEBUG)
|
||||
#define DLLOG(format, ...) cocos2d::log(format, ##__VA_ARGS__)
|
||||
#else
|
||||
#define DLLOG(...) do {} while (0)
|
||||
|
|
|
@ -34,6 +34,7 @@ android {
|
|||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
version "3.10.0+"
|
||||
path "../../CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ android {
|
|||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
version "3.10.0+"
|
||||
path "../../../../CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ android {
|
|||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
version "3.10.0+"
|
||||
path "../../CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ android {
|
|||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
version "3.10.0+"
|
||||
path "../../CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ android {
|
|||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
version "3.10.0+"
|
||||
path "../../CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ android {
|
|||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
version "3.10.0+"
|
||||
path "../../CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ android {
|
|||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
version "3.10.0+"
|
||||
path "../../CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue