File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33#include < vector>
44#include < hx/Thread.h>
55#include < hx/OS.h>
6-
6+ # include < mutex >
77
88
99#ifdef HX_WINRT
@@ -43,24 +43,21 @@ class Profiler
4343 mDumpFile = inDumpFile;
4444
4545 // When a profiler exists, the profiler thread needs to exist
46- gThreadMutex .Lock ();
46+
47+ std::lock_guard<std::mutex> lock (gThreadMutex );
4748
4849 gThreadRefCount += 1 ;
4950
5051 if (gThreadRefCount == 1 ) {
5152 HxCreateDetachedThread (ProfileMainLoop, 0 );
5253 }
53-
54- gThreadMutex .Unlock ();
5554 }
5655
5756 ~Profiler ()
5857 {
59- gThreadMutex . Lock ( );
58+ std::lock_guard<std::mutex> lock ( gThreadMutex );
6059
6160 gThreadRefCount -= 1 ;
62-
63- gThreadMutex .Unlock ();
6461 }
6562
6663 void sample (hx::StackContext *stack)
@@ -235,11 +232,11 @@ class Profiler
235232 int mT0 ;
236233 std::map<const char *, ProfileEntry> mProfileStats ;
237234
238- static HxMutex gThreadMutex ;
235+ static std::mutex gThreadMutex ;
239236 static int gThreadRefCount ;
240237 static int gProfileClock ;
241238};
242- /* static */ HxMutex Profiler::gThreadMutex ;
239+ /* static */ std::mutex Profiler::gThreadMutex ;
243240/* static */ int Profiler::gThreadRefCount ;
244241/* static */ int Profiler::gProfileClock ;
245242
You can’t perform that action at this time.
0 commit comments