summaryrefslogtreecommitdiff
path: root/mysys/my_thr_init.c
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)>2005-04-27 13:29:37 +0200
committerunknown <msvensson@neptunus.(none)>2005-04-27 13:29:37 +0200
commitc49d7f489106792e4924dfc31657abe4ab0d2d79 (patch)
tree81ccd0af6825dd1f4dd60d2cbe49fad7c95c488d /mysys/my_thr_init.c
parentbb4df7df8d32f18a393c6ee4eb0963b1ac37755f (diff)
downloadmariadb-git-c49d7f489106792e4924dfc31657abe4ab0d2d79.tar.gz
Bug #9954 mysql-4.1.11/cmd-line-utils/libedit/makelist.sh is not portable
- Reverted removal of errorcheck mutex initialise, used in safe_mutex_init. include/my_pthread.h: Reverted the removal of errorcheck mutex initializer mysys/my_thr_init.c: Reverted the removal of errorcheck mutex initializer Add destruction of mutex initializer
Diffstat (limited to 'mysys/my_thr_init.c')
-rw-r--r--mysys/my_thr_init.c14
1 files changed, 14 insertions, 0 deletions
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);