summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)>2005-04-27 13:30:00 +0200
committerunknown <msvensson@neptunus.(none)>2005-04-27 13:30:00 +0200
commit54c5950c131d353fcae243820a03114e8517c9c2 (patch)
tree3d2758d0be3ff6e6e15ed711ea8f9f060a82407c
parent6d5dd516270187bccf0ff356a87b91b64befa730 (diff)
parentc49d7f489106792e4924dfc31657abe4ab0d2d79 (diff)
downloadmariadb-git-54c5950c131d353fcae243820a03114e8517c9c2.tar.gz
Merge neptunus.(none):/home/msvensson/mysql/mysql-4.1
into neptunus.(none):/home/msvensson/mysql/mysql-5.0 include/my_pthread.h: Auto merged
-rw-r--r--include/my_pthread.h6
-rw-r--r--mysys/my_thr_init.c14
2 files changed, 20 insertions, 0 deletions
diff --git a/include/my_pthread.h b/include/my_pthread.h
index a84effda2dd..47a38d1a642 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -612,6 +612,12 @@ extern pthread_mutexattr_t 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_ERRCHK NULL
+#endif
extern my_bool my_thread_global_init(void);
extern void my_thread_global_end(void);
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c
index 93ba34ea5b4..878e1f6bfc6 100644
--- a/mysys/my_thr_init.c
+++ b/mysys/my_thr_init.c
@@ -40,6 +40,9 @@ pthread_mutex_t LOCK_gethostbyname_r;
#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
pthread_mutexattr_t my_fast_mutexattr;
#endif
+#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
+pthread_mutexattr_t my_errorcheck_mutexattr;
+#endif
/*
initialize thread environment
@@ -75,6 +78,14 @@ my_bool my_thread_global_init(void)
pthread_mutexattr_settype(&my_fast_mutexattr,
PTHREAD_MUTEX_ADAPTIVE_NP);
#endif
+#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
+ /*
+ Set mutex type to "errorcheck" a.k.a "adaptive"
+ */
+ pthread_mutexattr_init(&my_errorcheck_mutexattr);
+ pthread_mutexattr_settype(&my_errorcheck_mutexattr,
+ PTHREAD_MUTEX_ERRORCHECK);
+#endif
pthread_mutex_init(&THR_LOCK_malloc,MY_MUTEX_INIT_FAST);
pthread_mutex_init(&THR_LOCK_open,MY_MUTEX_INIT_FAST);
@@ -108,6 +119,9 @@ void my_thread_global_end(void)
#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_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);
pthread_mutex_destroy(&THR_LOCK_open);
pthread_mutex_destroy(&THR_LOCK_lock);