1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Fix for SAFE_MUTEX on windows

Docs/manual.texi:
  cleanup
include/my_pthread.h:
  Fix for SAFEMUTEX under windows
mysys/my_thr_init.c:
  Fix for SAFEMUTEX under windows
mysys/my_winthread.c:
  Fix for SAFEMUTEX under windows
mysys/thr_mutex.c:
  Fix for SAFEMUTEX under windows
sql/mysqld.cc:
  Remove unused code
sql/sql_table.cc:
  Fix filename comparison on Windows
support-files/Makefile.am:
  Added magic file
This commit is contained in:
unknown
2000-09-20 19:37:07 +03:00
parent 5993b4947b
commit 0d788b1e91
9 changed files with 46 additions and 21 deletions

View File

@@ -77,10 +77,19 @@ void my_thread_global_end(void)
static long thread_id=0;
/*
We can't use mutex_locks here if we re using windows as
we may have compiled the program with SAFE_MUTEX, in which
case the checking of mutex_locks will not work until
the pthread_self thread specific variable is initialized.
*/
my_bool my_thread_init(void)
{
struct st_my_thread_var *tmp;
#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
pthread_mutex_lock(&THR_LOCK_lock);
#endif
#if !defined(__WIN__) || defined(USE_TLS)
if (my_pthread_getspecific(struct st_my_thread_var *,THR_KEY_mysys))
{
@@ -98,9 +107,11 @@ my_bool my_thread_init(void)
pthread_setspecific(THR_KEY_mysys,tmp);
#else
if (THR_KEY_mysys.id) /* Allready initialized */
if (THR_KEY_mysys.id) /* Already initialized */
{
#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
pthread_mutex_unlock(&THR_LOCK_lock);
#endif
return 0;
}
tmp= &THR_KEY_mysys;
@@ -108,7 +119,9 @@ my_bool my_thread_init(void)
tmp->id= ++thread_id;
pthread_mutex_init(&tmp->mutex,NULL);
pthread_cond_init(&tmp->suspend, NULL);
#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
pthread_mutex_unlock(&THR_LOCK_lock);
#endif
return 0;
}