Merge branch 'crashlog_improvements' into jgrpp
# Conflicts: # source.list # src/openttd.cpp # src/stdafx.h # src/vehicle.cpp
This commit is contained in:
@@ -123,4 +123,14 @@ private:
|
||||
*/
|
||||
uint GetCPUCoreCount();
|
||||
|
||||
/**
|
||||
* Set the current thread as the "main" thread
|
||||
*/
|
||||
void SetSelfAsMainThread();
|
||||
|
||||
/**
|
||||
* @return true if the current thread definitely the "main" thread. If in doubt returns false.
|
||||
*/
|
||||
bool IsMainThread();
|
||||
|
||||
#endif /* THREAD_H */
|
||||
|
||||
@@ -199,3 +199,7 @@ private:
|
||||
if (thread != NULL) *thread = to;
|
||||
return true;
|
||||
}
|
||||
|
||||
void SetSelfAsMainThread() { }
|
||||
|
||||
bool IsMainThread() { return false; }
|
||||
|
||||
@@ -33,3 +33,7 @@ public:
|
||||
{
|
||||
return new ThreadMutex_None();
|
||||
}
|
||||
|
||||
void SetSelfAsMainThread() { }
|
||||
|
||||
bool IsMainThread() { return true; }
|
||||
|
||||
@@ -145,3 +145,7 @@ public:
|
||||
{
|
||||
return new ThreadMutex_OS2();
|
||||
}
|
||||
|
||||
void SetSelfAsMainThread() { }
|
||||
|
||||
bool IsMainThread() { return false; }
|
||||
|
||||
@@ -182,3 +182,15 @@ public:
|
||||
{
|
||||
return new ThreadMutex_pthread();
|
||||
}
|
||||
|
||||
static pthread_t main_thread;
|
||||
|
||||
void SetSelfAsMainThread()
|
||||
{
|
||||
main_thread = pthread_self();
|
||||
}
|
||||
|
||||
bool IsMainThread()
|
||||
{
|
||||
return main_thread == pthread_self();
|
||||
}
|
||||
|
||||
@@ -158,3 +158,15 @@ public:
|
||||
{
|
||||
return new ThreadMutex_Win32();
|
||||
}
|
||||
|
||||
static uint main_thread_id;
|
||||
|
||||
void SetSelfAsMainThread()
|
||||
{
|
||||
main_thread_id = GetCurrentThreadId();
|
||||
}
|
||||
|
||||
bool IsMainThread()
|
||||
{
|
||||
return main_thread_id == GetCurrentThreadId();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user