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 -4
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2019 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -82,16 +82,15 @@ void timer_LatchStartTime()
#endif
}
static pthread_mutex_t ensure_monotonic_mutex = PTHREAD_MUTEX_INITIALIZER;
static std::mutex ensure_monotonic_mutex;
// NB: does not guarantee strict monotonicity - callers must avoid
// dividing by the difference of two equal times.
static void EnsureMonotonic(double& newTime)
{
pthread_mutex_lock(&ensure_monotonic_mutex);
std::lock_guard<std::mutex> lock(ensure_monotonic_mutex);
static double maxTime;
maxTime = std::max(maxTime, newTime);
newTime = maxTime;
pthread_mutex_unlock(&ensure_monotonic_mutex);
}