From a280b4e661560943265cb443745b0b08374985a2 Mon Sep 17 00:00:00 2001 From: s_nakamoto Date: Thu, 8 Jul 2010 16:14:56 +0000 Subject: Laszlo's fix to make generate threads idle priority on Linux, replaced some wxBase dependencies: wxMutex, wxFileExists, wxStandardPaths, wxGetLocalTimeMillis --- util.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'util.h') diff --git a/util.h b/util.h index 40d46bc174..e92204f22d 100644 --- a/util.h +++ b/util.h @@ -141,6 +141,9 @@ void ParseParameters(int argc, char* argv[]); const char* wxGetTranslation(const char* psz); int GetFilesize(FILE* file); void GetDataDir(char* pszDirRet); +#ifdef __WXMSW__ +string MyGetSpecialFolderPath(int nFolder, bool fCreate); +#endif string GetDataDir(); void ShrinkDebugFile(); uint64 GetRand(uint64 nMax); @@ -174,13 +177,13 @@ public: bool TryEnter() { return TryEnterCriticalSection(&cs); } #else protected: - wxMutex mutex; + boost::interprocess::interprocess_recursive_mutex mutex; public: - explicit CCriticalSection() : mutex(wxMUTEX_RECURSIVE) { } + explicit CCriticalSection() { } ~CCriticalSection() { } - void Enter() { mutex.Lock(); } - void Leave() { mutex.Unlock(); } - bool TryEnter() { return mutex.TryLock() == wxMUTEX_NO_ERROR; } + void Enter() { mutex.lock(); } + void Leave() { mutex.unlock(); } + bool TryEnter() { return mutex.try_lock(); } #endif public: const char* pszFile; @@ -324,7 +327,8 @@ inline int64 PerformanceCounter() inline int64 GetTimeMillis() { - return wxGetLocalTimeMillis().GetValue(); + return (posix_time::ptime(posix_time::microsec_clock::universal_time()) - + posix_time::ptime(gregorian::date(1970,1,1))).total_milliseconds(); } inline string DateTimeStrFormat(const char* pszFormat, int64 nTime) @@ -513,7 +517,7 @@ inline pthread_t CreateThread(void(*pfn)(void*), void* parg, bool fWantHandle=fa return hthread; } -#define THREAD_PRIORITY_LOWEST PRIO_MIN +#define THREAD_PRIORITY_LOWEST PRIO_MAX #define THREAD_PRIORITY_BELOW_NORMAL 2 #define THREAD_PRIORITY_NORMAL 0 #define THREAD_PRIORITY_ABOVE_NORMAL 0 -- cgit v1.2.3