Merge pull request #539 from schwa423/linux_global_lock
Use pthread_mutex for global lock on Linux.
This commit is contained in:
commit
c658497846
@ -165,11 +165,29 @@ bool OS_FreeTLSIndex(OS_TLSIndex nIndex)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: non-windows: if we need these on linux, flesh them out
|
namespace {
|
||||||
void InitGlobalLock() { }
|
pthread_mutex_t gMutex;
|
||||||
void GetGlobalLock() { }
|
}
|
||||||
void ReleaseGlobalLock() { }
|
|
||||||
|
|
||||||
|
void InitGlobalLock()
|
||||||
|
{
|
||||||
|
pthread_mutexattr_t mutexattr;
|
||||||
|
pthread_mutexattr_init(&mutexattr);
|
||||||
|
pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_RECURSIVE);
|
||||||
|
pthread_mutex_init(&gMutex, &mutexattr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetGlobalLock()
|
||||||
|
{
|
||||||
|
pthread_mutex_lock(&gMutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReleaseGlobalLock()
|
||||||
|
{
|
||||||
|
pthread_mutex_unlock(&gMutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: non-windows: if we need these on linux, flesh them out
|
||||||
void* OS_CreateThread(TThreadEntrypoint /*entry*/)
|
void* OS_CreateThread(TThreadEntrypoint /*entry*/)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user