diff options
Diffstat (limited to 'mysys/my_thr_init.c')
-rw-r--r-- | mysys/my_thr_init.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index f62b8d5cb1a..45c10e5a7b6 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -15,8 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* -** Functions to handle initializating and allocationg of all mysys & debug -** thread variables. + Functions to handle initializating and allocationg of all mysys & debug + thread variables. */ #include "mysys_priv.h" @@ -44,10 +44,6 @@ pthread_mutexattr_t my_fast_mutexattr; pthread_mutexattr_t my_errchk_mutexattr; #endif -/* FIXME Note. TlsAlloc does not set an auto destructor, so - the function my_thread_global_free must be called from - somewhere before final exit of the library */ - my_bool my_thread_global_init(void) { if (pthread_key_create(&THR_KEY_mysys,free)) @@ -59,7 +55,7 @@ my_bool my_thread_global_init(void) pthread_mutexattr_init(&my_fast_mutexattr); pthread_mutexattr_setkind_np(&my_fast_mutexattr,PTHREAD_MUTEX_ADAPTIVE_NP); #endif -#ifdef PPTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP +#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP pthread_mutexattr_init(&my_errchk_mutexattr); pthread_mutexattr_setkind_np(&my_errchk_mutexattr, PTHREAD_MUTEX_ERRORCHECK_NP); @@ -86,6 +82,7 @@ my_bool my_thread_global_init(void) return my_thread_init(); } + void my_thread_global_end(void) { #if defined(USE_TLS) @@ -126,7 +123,7 @@ my_bool my_thread_init(void) #if !defined(__WIN__) || defined(USE_TLS) if (my_pthread_getspecific(struct st_my_thread_var *,THR_KEY_mysys)) { -#ifdef EXTRA_DEBUG +#ifdef EXTRA_DEBUG_THREADS fprintf(stderr,"my_thread_init() called more than once in thread %ld\n", pthread_self()); #endif @@ -158,6 +155,7 @@ end: return error; } + void my_thread_end(void) { struct st_my_thread_var *tmp=my_thread_var; @@ -204,8 +202,9 @@ struct st_my_thread_var *_my_thread_var(void) return tmp; } + /**************************************************************************** -** Get name of current thread. + Get name of current thread. ****************************************************************************/ #define UNKNOWN_THREAD -1 |