summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)>2005-04-27 12:56:01 +0200
committerunknown <msvensson@neptunus.(none)>2005-04-27 12:56:01 +0200
commit0e29519b2b4f06f2e37b59c7e9359331c15e83a4 (patch)
tree922f8cbd12ff26fed829ed3fbe11e44e2ea2923f /mysys
parent49b448ae5a91ed9c0dde57ecd1de724bf517d904 (diff)
parent78f89a729a962f7a88869a3d5e50ca493391b2a4 (diff)
downloadmariadb-git-0e29519b2b4f06f2e37b59c7e9359331c15e83a4.tar.gz
Merge from 4.1 to 5.0
client/mysql.cc: Auto merged include/my_pthread.h: Auto merged ndb/src/ndbapi/ndberror.c: Auto merged sql/examples/ha_archive.cc: Auto merged sql/examples/ha_archive.h: Auto merged BUILD/SETUP.sh: Manual merge of conflicts -DBIG_TABLES removed set by configure using --with-big-tables configure.in: manual merge mysql-test/r/archive.result: Manual merge mysql-test/t/archive.test: Manual merge
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_thr_init.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c
index 36b37f68b46..93ba34ea5b4 100644
--- a/mysys/my_thr_init.c
+++ b/mysys/my_thr_init.c
@@ -40,9 +40,6 @@ 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_errchk_mutexattr;
-#endif
/*
initialize thread environment
@@ -62,19 +59,21 @@ my_bool my_thread_global_init(void)
fprintf(stderr,"Can't initialize threads: error %d\n",errno);
return 1;
}
+
#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
- pthread_mutexattr_init(&my_fast_mutexattr);
/*
- Note that the following statement may give a compiler warning under
- some configurations, but there isn't anything we can do about this as
- this is a bug in the header files for the thread implementation
+ 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.
*/
- pthread_mutexattr_setkind_np(&my_fast_mutexattr,PTHREAD_MUTEX_ADAPTIVE_NP);
-#endif
-#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
- pthread_mutexattr_init(&my_errchk_mutexattr);
- pthread_mutexattr_setkind_np(&my_errchk_mutexattr,
- PTHREAD_MUTEX_ERRORCHECK_NP);
+ pthread_mutexattr_init(&my_fast_mutexattr);
+ pthread_mutexattr_settype(&my_fast_mutexattr,
+ PTHREAD_MUTEX_ADAPTIVE_NP);
#endif
pthread_mutex_init(&THR_LOCK_malloc,MY_MUTEX_INIT_FAST);
@@ -109,9 +108,6 @@ 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_errchk_mutexattr);
-#endif
pthread_mutex_destroy(&THR_LOCK_malloc);
pthread_mutex_destroy(&THR_LOCK_open);
pthread_mutex_destroy(&THR_LOCK_lock);