diff options
-rw-r--r-- | include/my_pthread.h | 38 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test | 1 | ||||
-rw-r--r-- | mysys/safemalloc.c | 2 | ||||
-rw-r--r-- | sql-common/client_plugin.c | 22 |
4 files changed, 13 insertions, 50 deletions
diff --git a/include/my_pthread.h b/include/my_pthread.h index 4f484265583..d10dd283555 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -139,6 +139,7 @@ int pthread_cancel(pthread_t thread); #define pthread_mutex_destroy(A) (DeleteCriticalSection(A), 0) #define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH) + /* Dummy defines for easier code */ #define pthread_attr_setdetachstate(A,B) pthread_dummy(0) #define pthread_attr_setscope(A,B) @@ -368,7 +369,6 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex); for calculating an absolute time at which pthread_cond_timedwait should timeout */ - #define set_timespec(ABSTIME,SEC) set_timespec_nsec((ABSTIME),(SEC)*1000000000ULL) #ifndef set_timespec_nsec @@ -473,24 +473,6 @@ void safe_mutex_free_deadlock_data(safe_mutex_t *mp); #define MYF_NO_DEADLOCK_DETECTION 2 #ifdef SAFE_MUTEX -#undef pthread_mutex_init -#undef pthread_mutex_lock -#undef pthread_mutex_unlock -#undef pthread_mutex_destroy -#undef pthread_mutex_wait -#undef pthread_mutex_timedwait -#undef pthread_mutex_t -#undef pthread_cond_wait -#undef pthread_cond_timedwait -#undef pthread_mutex_trylock -#define pthread_mutex_init(A,B) safe_mutex_init((A),(B),#A,__FILE__,__LINE__) -#define pthread_mutex_lock(A) safe_mutex_lock((A),0,__FILE__, __LINE__) -#define pthread_mutex_unlock(A) safe_mutex_unlock((A),__FILE__,__LINE__) -#define pthread_mutex_destroy(A) safe_mutex_destroy((A),__FILE__,__LINE__) -#define pthread_cond_wait(A,B) safe_cond_wait((A),(B),__FILE__,__LINE__) -#define pthread_cond_timedwait(A,B,C) safe_cond_timedwait((A),(B),(C),__FILE__,__LINE__) -#define pthread_mutex_trylock(A) safe_mutex_lock((A), MYF_TRY_LOCK, __FILE__, __LINE__) -#define pthread_mutex_t safe_mutex_t #define safe_mutex_assert_owner(mp) \ DBUG_ASSERT((mp)->count > 0 && \ pthread_equal(pthread_self(), (mp)->thread)) @@ -528,24 +510,6 @@ int my_pthread_fastmutex_init(my_pthread_fastmutex_t *mp, const pthread_mutexattr_t *attr); int my_pthread_fastmutex_lock(my_pthread_fastmutex_t *mp); -#undef pthread_mutex_init -#undef pthread_mutex_lock -#undef pthread_mutex_unlock -#undef pthread_mutex_destroy -#undef pthread_mutex_wait -#undef pthread_mutex_timedwait -#undef pthread_mutex_t -#undef pthread_cond_wait -#undef pthread_cond_timedwait -#undef pthread_mutex_trylock -#define pthread_mutex_init(A,B) my_pthread_fastmutex_init((A),(B)) -#define pthread_mutex_lock(A) my_pthread_fastmutex_lock(A) -#define pthread_mutex_unlock(A) pthread_mutex_unlock(&(A)->mutex) -#define pthread_mutex_destroy(A) pthread_mutex_destroy(&(A)->mutex) -#define pthread_cond_wait(A,B) pthread_cond_wait((A),&(B)->mutex) -#define pthread_cond_timedwait(A,B,C) pthread_cond_timedwait((A),&(B)->mutex,(C)) -#define pthread_mutex_trylock(A) pthread_mutex_trylock(&(A)->mutex) -#define pthread_mutex_t my_pthread_fastmutex_t #endif /* defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) */ /* READ-WRITE thread locking */ diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test index 5d2701081e8..c50d2d66dff 100644 --- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test @@ -9,6 +9,7 @@ SET @orig = @@global.innodb_buffer_pool_filename; SELECT @orig; let $old_val=query_get_value(SHOW STATUS LIKE 'innodb_buffer_pool_dump_status', Value, 1); +sleep 1; # to ensure that the previous and the next dumps are at least a second apart # Try with a non-default filename diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c index 31f0333725f..2f01573fee7 100644 --- a/mysys/safemalloc.c +++ b/mysys/safemalloc.c @@ -96,8 +96,6 @@ void *sf_malloc(size_t size) if (!init_done) { pthread_mutex_init(&sf_mutex, NULL); - /* disable deadlock detector, because it calls my_malloc() */ - safe_mutex_setflags(&sf_mutex, MYF_NO_DEADLOCK_DETECTION); atexit(sf_terminate); init_done= 1; } diff --git a/sql-common/client_plugin.c b/sql-common/client_plugin.c index f31ddb22a6a..b8857cbe8bb 100644 --- a/sql-common/client_plugin.c +++ b/sql-common/client_plugin.c @@ -70,7 +70,7 @@ static uint plugin_version[MYSQL_CLIENT_MAX_PLUGINS]= loading the same plugin twice in parallel. */ struct st_client_plugin_int *plugin_list[MYSQL_CLIENT_MAX_PLUGINS]; -static pthread_mutex_t LOCK_load_client_plugin; +static mysql_mutex_t LOCK_load_client_plugin; static int is_not_initialized(MYSQL *mysql, const char *name) { @@ -170,7 +170,7 @@ add_plugin(MYSQL *mysql, struct st_mysql_client_plugin *plugin, void *dlhandle, goto err2; } - safe_mutex_assert_owner(&LOCK_load_client_plugin); + mysql_mutex_assert_owner(&LOCK_load_client_plugin); p->next= plugin_list[plugin->type]; plugin_list[plugin->type]= p; @@ -250,19 +250,19 @@ int mysql_client_plugin_init() bzero(&mysql, sizeof(mysql)); /* dummy mysql for set_mysql_extended_error */ - pthread_mutex_init(&LOCK_load_client_plugin, MY_MUTEX_INIT_SLOW); + mysql_mutex_init(0, &LOCK_load_client_plugin, MY_MUTEX_INIT_SLOW); init_alloc_root(&mem_root, 128, 128); bzero(&plugin_list, sizeof(plugin_list)); initialized= 1; - pthread_mutex_lock(&LOCK_load_client_plugin); + mysql_mutex_lock(&LOCK_load_client_plugin); for (builtin= mysql_client_builtins; *builtin; builtin++) add_plugin(&mysql, *builtin, 0, 0, unused); - pthread_mutex_unlock(&LOCK_load_client_plugin); + mysql_mutex_unlock(&LOCK_load_client_plugin); load_env_plugins(&mysql); @@ -295,7 +295,7 @@ void mysql_client_plugin_deinit() bzero(&plugin_list, sizeof(plugin_list)); initialized= 0; free_root(&mem_root, MYF(0)); - pthread_mutex_destroy(&LOCK_load_client_plugin); + mysql_mutex_destroy(&LOCK_load_client_plugin); DBUG_VOID_RETURN; } @@ -313,7 +313,7 @@ mysql_client_register_plugin(MYSQL *mysql, if (is_not_initialized(mysql, plugin->name)) DBUG_RETURN(NULL); - pthread_mutex_lock(&LOCK_load_client_plugin); + mysql_mutex_lock(&LOCK_load_client_plugin); /* make sure the plugin wasn't loaded meanwhile */ if (find_plugin(plugin->name, plugin->type)) @@ -326,7 +326,7 @@ mysql_client_register_plugin(MYSQL *mysql, else plugin= add_plugin(mysql, plugin, 0, 0, unused); - pthread_mutex_unlock(&LOCK_load_client_plugin); + mysql_mutex_unlock(&LOCK_load_client_plugin); DBUG_RETURN(plugin); } @@ -348,7 +348,7 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type, DBUG_RETURN (NULL); } - pthread_mutex_lock(&LOCK_load_client_plugin); + mysql_mutex_lock(&LOCK_load_client_plugin); /* make sure the plugin wasn't loaded meanwhile */ if (type >= 0 && find_plugin(name, type)) @@ -401,13 +401,13 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type, plugin= add_plugin(mysql, plugin, dlhandle, argc, args); - pthread_mutex_unlock(&LOCK_load_client_plugin); + mysql_mutex_unlock(&LOCK_load_client_plugin); DBUG_PRINT ("leave", ("plugin loaded ok")); DBUG_RETURN (plugin); err: - pthread_mutex_unlock(&LOCK_load_client_plugin); + mysql_mutex_unlock(&LOCK_load_client_plugin); DBUG_PRINT ("leave", ("plugin load error : %s", errmsg)); set_mysql_extended_error(mysql, CR_AUTH_PLUGIN_CANNOT_LOAD, unknown_sqlstate, ER(CR_AUTH_PLUGIN_CANNOT_LOAD), name, errmsg); |