Skip to content
Snippets Groups Projects
Commit 7c1736c0 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

port from pd-l2ork git: d095289d968720dec4fcba7e2c0dcaa95252278e

*updated locking mechanism to prevent multiple locks or unlocks in a row, which in turn causes crashes on newer Intel processors.
parent 12a8f705
No related branches found
No related tags found
No related merge requests found
......@@ -581,15 +581,27 @@ int m_batchmain(void)
#ifdef THREAD_LOCKING
static pthread_mutex_t sys_mutex = PTHREAD_MUTEX_INITIALIZER;
static int sys_mutex_lock = 0;
//#include <stdio.h>
void sys_lock(void)
{
pthread_mutex_lock(&sys_mutex);
//fprintf(stderr,"sys_lock\n");
if (!sys_mutex_lock)
{
pthread_mutex_lock(&sys_mutex);
sys_mutex_lock = 1;
}
}
void sys_unlock(void)
{
pthread_mutex_unlock(&sys_mutex);
//fprintf(stderr,"sys_unlock\n");
if (sys_mutex_lock)
{
pthread_mutex_unlock(&sys_mutex);
sys_mutex_lock = 0;
}
}
int sys_trylock(void)
......
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