mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-10-09 07:39:40 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user