HomeWildfire Games

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

Description

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

Event Timeline

elexis added a subscriber: elexis.Aug 12 2019, 2:29 PM

When compiling with clang 8.0.1:

In file included from ../../../source/graphics/TextureConverter.cpp:20:
../../../source/graphics/TextureConverter.h:209:7: error: no type named 'mutex' in namespace 'std'
        std::mutex m_WorkerMutex;
        ~~~~~^
../../../source/graphics/TextureConverter.cpp:289:6: warning: unused variable 'ret' [-Wunused-variable]
        int ret;
            ^
In file included from ../../../source/graphics/TextureConverter.cpp:20:
../../../source/graphics/TextureConverter.h:209:13: warning: private field 'm_WorkerMutex' is not used [-Wunused-private-field]
        std::mutex m_WorkerMutex;
                   ^
2 warnings and 1 error generated.
make[1]: *** [graphics.make:350: obj/graphics_Release/TextureConverter.o] Error 1
make[1]: *** Waiting for unfinished jobs....
ICmpObstruction.cpp
ICmpObstructionManager.cpp
In file included from ../../../source/graphics/TextureManager.cpp:27:
../../../source/graphics/TextureConverter.h:209:7: error: no type named 'mutex' in namespace 'std'
        std::mutex m_WorkerMutex;
        ~~~~~^
1 error generated.
make[1]: *** [graphics.make:353: obj/graphics_Release/TextureManager.o] Error 1
make: *** [Makefile:115: graphics] Error 2
make: *** Waiting for unfinished jobs....
../../../source/lib/timer.cpp:85:13: error: no type named 'mutex' in namespace 'std'
static std::mutex ensure_monotonic_mutex;
       ~~~~~^
../../../source/lib/timer.cpp:90:7: error: no member named 'lock_guard' in namespace 'std'
        std::lock_guard<std::mutex> lock(ensure_monotonic_mutex);
        ~~~~~^
../../../source/lib/timer.cpp:90:23: error: no member named 'mutex' in namespace 'std'
        std::lock_guard<std::mutex> lock(ensure_monotonic_mutex);
                        ~~~~~^
/ps/trunk/source/graphics/TextureConverter.cpp
289
../../../source/graphics/TextureConverter.cpp:289:6: warning: unused variable 'ret' [-Wunused-variable]
        int ret;
            ^
1 warning generated.
/ps/trunk/source/graphics/TextureConverter.h
26

#include <mutex>

/ps/trunk/source/lib/timer.cpp
34

#include <mutex>

/ps/trunk/source/soundmanager/SoundManager.cpp
35

(header has the mutex include)

/ps/trunk/source/tools/atlas/GameInterface/GameLoop.cpp
20

below the rest

311