Below is the list of changes that have just been committed into a local
4.1 repository of msvensson. When msvensson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2222 05/05/03 12:36:55 msvensson@neptunus.(none) +3 -0
BUG#9954
- Check for existens of pthread_mutexattr_settype or pthread_mutexattr_setkind_np and
if any of these functions are found, use them to init the errorcheck and fast mutex
attrs.
mysys/my_thr_init.c
1.31 05/05/03 12:36:52 msvensson@neptunus.(none) +26 -13
Initialize the mutex attrs if functions for this are available
include/my_pthread.h
1.80 05/05/03 12:36:52 msvensson@neptunus.(none) +2 -5
Define macros for FAST and ERROCHECK mutex attr initializers if functions to
initialize the mutex attrs are available.
configure.in
1.369 05/05/03 12:36:52 msvensson@neptunus.(none) +2 -1
Check for functions pthread_mutexattr_settype and pthread_mutexattr_setkind_np
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: msvensson
# Host: neptunus.(none)
# Root: /home/msvensson/mysql/bug9954
--- 1.368/configure.in 2005-05-02 17:05:57 +02:00
+++ 1.369/configure.in 2005-05-03 12:36:52 +02:00
@@ -1959,7 +1959,8 @@
mkstemp mlockall perror poll pread pthread_attr_create \
pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \
pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
- pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
+ pthread_key_delete pthread_mutexattr_settype pthread_mutexattr_setkind_np \
+ pthread_rwlock_rdlock pthread_setprio \
pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
realpath rename rint rwlock_init setupterm \
shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \
--- 1.79/include/my_pthread.h 2005-04-27 13:29:34 +02:00
+++ 1.80/include/my_pthread.h 2005-05-03 12:36:52 +02:00
@@ -606,16 +606,13 @@
/* Define mutex types, see my_thr_init.c */
#define MY_MUTEX_INIT_SLOW NULL
-#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
+#if defined(HAVE_PTHREAD_MUTEXATTR_SETTYPE) || defined
(HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
extern pthread_mutexattr_t my_fast_mutexattr;
#define MY_MUTEX_INIT_FAST &my_fast_mutexattr
-#else
-#define MY_MUTEX_INIT_FAST NULL
-#endif
-#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
extern pthread_mutexattr_t my_errorcheck_mutexattr;
#define MY_MUTEX_INIT_ERRCHK &my_errorcheck_mutexattr
#else
+#define MY_MUTEX_INIT_FAST NULL
#define MY_MUTEX_INIT_ERRCHK NULL
#endif
--- 1.30/mysys/my_thr_init.c 2005-04-27 13:29:34 +02:00
+++ 1.31/mysys/my_thr_init.c 2005-05-03 12:36:52 +02:00
@@ -37,10 +37,8 @@
#ifndef HAVE_GETHOSTBYNAME_R
pthread_mutex_t LOCK_gethostbyname_r;
#endif
-#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
+#if defined(HAVE_PTHREAD_MUTEXATTR_SETTYPE) || defined
(HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
pthread_mutexattr_t my_fast_mutexattr;
-#endif
-#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
pthread_mutexattr_t my_errorcheck_mutexattr;
#endif
@@ -63,28 +61,45 @@
return 1;
}
-#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
/*
- Set mutex type to "fast" a.k.a "adaptive"
-
The mutex kind determines what happens if a thread attempts to lock
a mutex it already owns with pthread_mutex_lock(3). If the mutex
is of the ``fast'' kind, pthread_mutex_lock(3) simply suspends
the calling thread forever. If the mutex is of the ``error checking''
kind, pthread_mutex_lock(3) returns immediately with the error
code EDEADLK.
+
+ */
+#if defined(HAVE_PTHREAD_MUTEXATTR_SETTYPE)
+ /*
+ Set mutex type to "fast" a.k.a "adaptive"
*/
pthread_mutexattr_init(&my_fast_mutexattr);
pthread_mutexattr_settype(&my_fast_mutexattr,
- PTHREAD_MUTEX_ADAPTIVE_NP);
-#endif
-#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
+ PTHREAD_MUTEX_NORMAL);
+
/*
- Set mutex type to "errorcheck" a.k.a "adaptive"
+ Set mutex type to "errorcheck"
*/
pthread_mutexattr_init(&my_errorcheck_mutexattr);
pthread_mutexattr_settype(&my_errorcheck_mutexattr,
PTHREAD_MUTEX_ERRORCHECK);
+
+#elif defined(HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
+ /*
+ Set mutex type to "fast" a.k.a "adaptive"
+ */
+ pthread_mutexattr_init(&my_fast_mutexattr);
+ pthread_mutexattr_setkind_np(&my_fast_mutexattr,
+ PTHREAD_MUTEX_FAST_NP);
+
+ /*
+ Set mutex type to "errorcheck"
+ */
+ pthread_mutexattr_init(&my_errorcheck_mutexattr);
+ pthread_mutexattr_setkind_np(&my_errorcheck_mutexattr,
+ PTHREAD_MUTEX_ERRORCHECK_NP);
+
#endif
pthread_mutex_init(&THR_LOCK_malloc,MY_MUTEX_INIT_FAST);
@@ -116,10 +131,8 @@
void my_thread_global_end(void)
{
pthread_key_delete(THR_KEY_mysys);
-#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
+#if defined(HAVE_PTHREAD_MUTEXATTR_SETTYPE) || defined
(HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
pthread_mutexattr_destroy(&my_fast_mutexattr);
-#endif
-#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
pthread_mutexattr_destroy(&my_errorcheck_mutexattr);
#endif
pthread_mutex_destroy(&THR_LOCK_malloc);
| Thread |
|---|
| • bk commit into 4.1 tree (msvensson:1.2222) BUG#9954 | msvensson | 3 May |