# Patch created by kt # Date: Fr Sep 1 20:56:39 CEST 2006 # Repository: pnet # Comments: # # Use recursive mutexes by default #### End of Preamble #### #### Patch data follows #### Index: support/pt_defs.c =================================================================== RCS file: /cvsroot/dotgnu-pnet/pnet/support/pt_defs.c,v retrieving revision 1.8 diff -c -r1.8 pt_defs.c *** support/pt_defs.c 10 Oct 2005 20:03:15 -0000 1.8 --- support/pt_defs.c 1 Sep 2006 18:56:40 -0000 *************** *** 46,51 **** --- 46,56 ---- pthread_key_t _ILThreadObjectKey; /* + * Default mutex attribute. + */ + pthread_mutexattr_t _ILMutexAttr; + + /* * Suspend until we receive IL_SIG_RESUME from another thread * in this process. * *************** *** 158,163 **** --- 163,174 ---- /* We need a thread-specific key for storing thread objects */ pthread_key_create(&_ILThreadObjectKey, (void (*)(void *))0); + /* Initialize the mutexattr used on this system. */ + pthread_mutexattr_init(&_ILMutexAttr); + #ifdef PTHREAD_MUTEX_RECURSIVE + pthread_mutexattr_settype(&_ILMutexAttr, PTHREAD_MUTEX_RECURSIVE); + #endif + /* Block the IL_SIG_RESUME signal in the current thread. It will be unblocked by "SuspendUntilResumed" */ sigemptyset(&set); Index: support/pt_defs.h =================================================================== RCS file: /cvsroot/dotgnu-pnet/pnet/support/pt_defs.h,v retrieving revision 1.9 diff -c -r1.9 pt_defs.h *** support/pt_defs.h 1 Nov 2005 19:14:19 -0000 1.9 --- support/pt_defs.h 1 Sep 2006 18:56:41 -0000 *************** *** 156,163 **** * Primitive mutex operations. Note: the "Lock" and "Unlock" * operations are not "suspend-safe". */ #define _ILMutexCreate(mutex) \ ! (pthread_mutex_init((mutex), (pthread_mutexattr_t *)0)) #define _ILMutexDestroy(mutex) \ (pthread_mutex_destroy((mutex))) #define _ILMutexLockUnsafe(mutex) \ --- 156,164 ---- * Primitive mutex operations. Note: the "Lock" and "Unlock" * operations are not "suspend-safe". */ + extern pthread_mutexattr_t _ILMutexAttr; #define _ILMutexCreate(mutex) \ ! (pthread_mutex_init((mutex), &_ILMutexAttr)) #define _ILMutexDestroy(mutex) \ (pthread_mutex_destroy((mutex))) #define _ILMutexLockUnsafe(mutex) \ *************** *** 173,178 **** --- 174,181 ---- #define _ILCondMutexCreate(mutex) _ILMutexCreate((mutex)) #define _ILCondMutexDestroy(mutex) _ILMutexDestroy((mutex)) #define _ILCondMutexLockUnsafe(mutex) _ILMutexLockUnsafe((mutex)) + #define _ILCondMutexTryLockUnsafe(mutex) \ + (pthread_mutex_trylock((mutex))) #define _ILCondMutexUnlockUnsafe(mutex) _ILMutexUnlockUnsafe((mutex)) /* #### End of Patch data ####