pthread -> std::thread (3/7) - Replace pthread in other engine files

MapGenerator, TextureConverter, and some other files used pthread.

Differential Revision: https://code.wildfiregames.com/D1917
This was SVN commit r22649.
This commit is contained in:
wraitii
2019-08-12 08:16:28 +00:00
parent 8ef8a9de89
commit 107d3d461f
8 changed files with 64 additions and 80 deletions
+3 -6
View File
@@ -66,7 +66,7 @@ CMapGeneratorWorker::CMapGeneratorWorker()
CMapGeneratorWorker::~CMapGeneratorWorker()
{
// Wait for thread to end
pthread_join(m_WorkerThread, NULL);
m_WorkerThread.join();
}
void CMapGeneratorWorker::Initialize(const VfsPath& scriptFile, const std::string& settings)
@@ -79,17 +79,14 @@ void CMapGeneratorWorker::Initialize(const VfsPath& scriptFile, const std::strin
m_Settings = settings;
// Launch the worker thread
int ret = pthread_create(&m_WorkerThread, NULL, &RunThread, this);
ENSURE(ret == 0);
m_WorkerThread = std::thread(RunThread, this);
}
void* CMapGeneratorWorker::RunThread(void *data)
void* CMapGeneratorWorker::RunThread(CMapGeneratorWorker* self)
{
debug_SetThreadName("MapGenerator");
g_Profiler2.RegisterCurrentThread("MapGenerator");
CMapGeneratorWorker* self = static_cast<CMapGeneratorWorker*>(data);
shared_ptr<ScriptRuntime> mapgenRuntime = ScriptInterface::CreateRuntime(g_ScriptRuntime, RMS_RUNTIME_SIZE);
// Enable the script to be aborted