Skip to content
Snippets Groups Projects
Commit c6584978 authored by John Kessenich's avatar John Kessenich Committed by GitHub
Browse files

Merge pull request #539 from schwa423/linux_global_lock

Use pthread_mutex for global lock on Linux.
parents 1b6daa04 425af5f6
No related branches found
No related tags found
No related merge requests found
......@@ -165,11 +165,29 @@ bool OS_FreeTLSIndex(OS_TLSIndex nIndex)
return false;
}
// TODO: non-windows: if we need these on linux, flesh them out
void InitGlobalLock() { }
void GetGlobalLock() { }
void ReleaseGlobalLock() { }
namespace {
pthread_mutex_t gMutex;
}
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*/)
{
return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment