rendered paste body# Patch created by ktreichel
# Date: Mon Sep 4 18:10:17 2006
# Repository: libjit
# Comments:
#
# Fix Mutexes
# -
#### End of Preamble ####
#### Patch data follows ####
Index: jit/jit-thread.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/libjit/jit/jit-thread.c,v
retrieving revision 1.2
diff -c -r1.2 jit-thread.c
*** jit/jit-thread.c 28 Oct 2004 01:23:09 -0000 1.2
--- jit/jit-thread.c 4 Sep 2006 16:08:22 -0000
***************
*** 42,47 ****
--- 42,52 ----
static pthread_key_t control_key;
/*
+ * Attributes for a mutex used by the jit.
+ */
+ pthread_mutexattr_t _jit_mutex_attr;
+
+ /*
* Initialize the pthread support routines. Only called once.
*/
static void init_pthread(void)
***************
*** 50,55 ****
--- 55,66 ----
control object, and arrange for it to be freed when the
thread exits or is otherwise terminated */
pthread_key_create(&control_key, jit_free);
+
+ /* Set the attribute for the mutex to be used. */
+ pthread_mutexattr_init(&_jit_mutex_attr);
+ #ifdef PTHREAD_MUTEX_NORMAL
+ pthread_mutexattr_settype(&_jit_mutex_attr, PTHREAD_MUTEX_NORMAL);
+ #endif
}
#elif defined(JIT_THREADS_WIN32)
Index: jit/jit-thread.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/libjit/jit/jit-thread.h,v
retrieving revision 1.2
diff -c -r1.2 jit-thread.h
*** jit/jit-thread.h 28 Oct 2004 01:23:09 -0000 1.2
--- jit/jit-thread.h 4 Sep 2006 16:08:23 -0000
***************
*** 23,28 ****
--- 23,29 ----
#include <config.h>
#if defined(HAVE_PTHREAD_H) && defined(HAVE_LIBPTHREAD)
+ #define _GNU_SOURCE
#include <pthread.h>
#elif defined(JIT_WIN32_PLATFORM)
#include <windows.h>
***************
*** 91,98 ****
*/
#if defined(JIT_THREADS_PTHREAD)
typedef pthread_mutex_t jit_mutex_t;
! #define jit_mutex_create(mutex) (pthread_mutex_init((mutex), 0))
#define jit_mutex_destroy(mutex) (pthread_mutex_destroy((mutex)))
#define jit_mutex_lock(mutex) (pthread_mutex_lock((mutex)))
#define jit_mutex_unlock(mutex) (pthread_mutex_unlock((mutex)))
--- 92,101 ----
*/
#if defined(JIT_THREADS_PTHREAD)
+ extern pthread_mutexattr_t _jit_mutex_attr;
+
typedef pthread_mutex_t jit_mutex_t;
! #define jit_mutex_create(mutex) (pthread_mutex_init((mutex), &_jit_mutex_attr))
#define jit_mutex_destroy(mutex) (pthread_mutex_destroy((mutex)))
#define jit_mutex_lock(mutex) (pthread_mutex_lock((mutex)))
#define jit_mutex_unlock(mutex) (pthread_mutex_unlock((mutex)))
#### End of Patch data ####