diff options
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/Makefile.am | 12 | ||||
-rw-r--r-- | mysys/charset-def.c | 1 | ||||
-rw-r--r-- | mysys/checksum.c | 4 | ||||
-rw-r--r-- | mysys/mf_iocache2.c | 49 | ||||
-rw-r--r-- | mysys/mf_keycache.c | 19 | ||||
-rw-r--r-- | mysys/my_compress.c | 2 | ||||
-rw-r--r-- | mysys/my_copy.c | 2 | ||||
-rw-r--r-- | mysys/my_error.c | 23 | ||||
-rw-r--r-- | mysys/my_getopt.c | 7 | ||||
-rw-r--r-- | mysys/my_handler.c | 2 | ||||
-rw-r--r-- | mysys/my_init.c | 2 | ||||
-rw-r--r-- | mysys/my_safehash.c | 2 | ||||
-rw-r--r-- | mysys/my_static.c | 13 | ||||
-rw-r--r-- | mysys/my_thr_init.c | 6 | ||||
-rw-r--r-- | mysys/my_wincond.c | 1 | ||||
-rw-r--r-- | mysys/my_winthread.c | 2 | ||||
-rw-r--r-- | mysys/mysys_priv.h | 1 | ||||
-rw-r--r-- | mysys/thr_alarm.c | 2 | ||||
-rw-r--r-- | mysys/thr_lock.c | 26 | ||||
-rw-r--r-- | mysys/thr_mutex.c | 36 | ||||
-rw-r--r-- | mysys/wqueue.c | 10 |
21 files changed, 60 insertions, 162 deletions
diff --git a/mysys/Makefile.am b/mysys/Makefile.am index 0962cfc9636..da5a2fa0b3b 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -88,12 +88,12 @@ libmysys_a_DEPENDENCIES= @THREAD_LOBJECTS@ # I hope this always does the right thing. Otherwise this is only test programs FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@ -CLEANFILES = test_bitmap$(EXEEXT) test_priority_queue$(EXEEXT) \ - test_thr_alarm$(EXEEXT) test_thr_lock$(EXEEXT) \ - test_vsnprintf$(EXEEXT) test_io_cache$(EXEEXT) \ - test_dir$(EXEEXT) test_charset$(EXEEXT) \ - testhash$(EXEEXT) test_gethwaddr$(EXEEXT) \ - test_base64$(EXEEXT) test_thr_mutex$(EXEEXT) +#CLEANFILES = test_bitmap$(EXEEXT) test_priority_queue$(EXEEXT) \ +# test_thr_alarm$(EXEEXT) test_thr_lock$(EXEEXT) \ +# test_vsnprintf$(EXEEXT) test_io_cache$(EXEEXT) \ +# test_dir$(EXEEXT) test_charset$(EXEEXT) \ +# testhash$(EXEEXT) test_gethwaddr$(EXEEXT) \ +# test_base64$(EXEEXT) test_thr_mutex$(EXEEXT) # # The CP .. RM stuff is to avoid problems with some compilers (like alpha ccc) diff --git a/mysys/charset-def.c b/mysys/charset-def.c index 82b3db32c43..703cd8568e0 100644 --- a/mysys/charset-def.c +++ b/mysys/charset-def.c @@ -141,6 +141,7 @@ extern struct charset_info_st my_charset_utf8mb4_persian_uca_ci; extern struct charset_info_st my_charset_utf8mb4_esperanto_uca_ci; extern struct charset_info_st my_charset_utf8mb4_hungarian_uca_ci; extern struct charset_info_st my_charset_utf8mb4_sinhala_uca_ci; +extern struct charset_info_st my_charset_utf8mb4_croatian_uca_ci; #endif /* HAVE_CHARSET_utf8mb4 */ #endif /* HAVE_UCA_COLLATIONS */ diff --git a/mysys/checksum.c b/mysys/checksum.c index b2579351134..c8d3c1a038d 100644 --- a/mysys/checksum.c +++ b/mysys/checksum.c @@ -18,7 +18,7 @@ #include <my_sys.h> #include <zlib.h> -ha_checksum my_crc_dbug_check= 1; /* Unlikely number */ +ulong my_crc_dbug_check= ~0; /* Cannot happen */ /* Calculate a long checksum for a memoryblock. @@ -34,7 +34,7 @@ ha_checksum my_checksum(ha_checksum crc, const uchar *pos, size_t length) { crc= (ha_checksum) crc32((uint)crc, pos, (uint) length); DBUG_PRINT("info", ("crc: %lu", (ulong) crc)); - if (crc == my_crc_dbug_check) + if ((ulong)crc == my_crc_dbug_check) my_debug_put_break_here(); return crc; } diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c index 04a5214e2d4..c74504e4fa8 100644 --- a/mysys/mf_iocache2.c +++ b/mysys/mf_iocache2.c @@ -474,52 +474,3 @@ err: return (size_t) -1; } - -int init_strvar_from_file(char *var, int max_size, IO_CACHE *f, - const char *default_val) -{ - uint length; - DBUG_ENTER("init_strvar_from_file"); - - if ((length=my_b_gets(f,var, max_size))) - { - char* last_p = var + length -1; - if (*last_p == '\n') - *last_p = 0; /* if we stopped on newline, kill it */ - else - { - /* - If we truncated a line or stopped on last char, remove all chars - up to and including newline. - */ - int c; - while (((c=my_b_get(f)) != '\n' && c != my_b_EOF)) - ; - } - DBUG_RETURN(0); - } - else if (default_val) - { - strmake(var, default_val, max_size-1); - DBUG_RETURN(0); - } - DBUG_RETURN(1); -} - -int init_intvar_from_file(int* var, IO_CACHE* f, int default_val) -{ - char buf[32]; - DBUG_ENTER("init_intvar_from_file"); - - if (my_b_gets(f, buf, sizeof(buf))) - { - *var = atoi(buf); - DBUG_RETURN(0); - } - else if (default_val) - { - *var = default_val; - DBUG_RETURN(0); - } - DBUG_RETURN(1); -} diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index 6a283383e24..41b93517655 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -179,10 +179,10 @@ typedef struct st_simple_key_cache_cb HASH_LINK *free_hash_list; /* list of free hash links */ BLOCK_LINK *free_block_list; /* list of free blocks */ BLOCK_LINK *block_root; /* memory for block links */ - uchar HUGE_PTR *block_mem; /* memory for block buffers */ + uchar *block_mem; /* memory for block buffers */ BLOCK_LINK *used_last; /* ptr to the last block of the LRU chain */ BLOCK_LINK *used_ins; /* ptr to the insertion block in LRU chain */ - pthread_mutex_t cache_lock; /* to lock access to the cache structure */ + mysql_mutex_t cache_lock; /* to lock access to the cache structure */ KEYCACHE_WQUEUE resize_queue; /* threads waiting during resize operation */ /* Waiting for a zero resize count. Using a queue for symmetry though @@ -793,7 +793,7 @@ void finish_resize_simple_key_cache(SIMPLE_KEY_CACHE_CB *keycache, if (acquire_lock) keycache_pthread_mutex_lock(&keycache->cache_lock); - safe_mutex_assert_owner(&keycache->cache_lock); + mysql_mutex_assert_owner(&keycache->cache_lock); /* Mark the resize finished. This allows other threads to start a @@ -5195,7 +5195,7 @@ int init_partitioned_key_cache(PARTITIONED_KEY_CACHE_CB *keycache, end_simple_key_cache(partition, 1); if (!key_cache_inited) { - my_free(partition, MYF(0)); + my_free(partition); partition= 0; } if ((i == 0 && cnt < 0) || i > 0) @@ -5214,7 +5214,7 @@ int init_partitioned_key_cache(PARTITIONED_KEY_CACHE_CB *keycache, */ if (key_cache_inited) { - my_free(partition, MYF(0)); + my_free(partition); partition= 0; if(key_cache_inited) memmove(partition_ptr, partition_ptr+1, @@ -5423,8 +5423,8 @@ void end_partitioned_key_cache(PARTITIONED_KEY_CACHE_CB *keycache, if (cleanup) { for (i= 0; i < partitions; i++) - my_free((uchar*) keycache->partition_array[i], MYF(0)); - my_free((uchar*) keycache->partition_array, MYF(0)); + my_free(keycache->partition_array[i]); + my_free(keycache->partition_array); keycache->key_cache_inited= 0; } DBUG_VOID_RETURN; @@ -6121,7 +6121,7 @@ void end_key_cache(KEY_CACHE *keycache, my_bool cleanup) { if (keycache->keycache_cb) { - my_free((uchar *) keycache->keycache_cb, MYF(0)); + my_free(keycache->keycache_cb); keycache->keycache_cb= 0; } keycache->key_cache_inited= 0; @@ -6363,7 +6363,8 @@ int flush_key_blocks(KEY_CACHE *keycache, */ int reset_key_cache_counters(const char *name __attribute__((unused)), - KEY_CACHE *keycache) + KEY_CACHE *keycache, + void *unused __attribute__((unused))) { if (keycache->key_cache_inited) { diff --git a/mysys/my_compress.c b/mysys/my_compress.c index d408520a862..98f96f6b2b6 100644 --- a/mysys/my_compress.c +++ b/mysys/my_compress.c @@ -89,7 +89,7 @@ void *my_az_allocator(void *dummy __attribute__((unused)), unsigned int items, void my_az_free(void *dummy __attribute__((unused)), void *address) { - my_free(address, MYF(MY_ALLOW_ZERO_PTR)); + my_free(address); } /* diff --git a/mysys/my_copy.c b/mysys/my_copy.c index 17bb796fd9b..c2f4f53a780 100644 --- a/mysys/my_copy.c +++ b/mysys/my_copy.c @@ -122,7 +122,7 @@ int my_copy(const char *from, const char *to, myf MyFlags) { my_errno= errno; if (MyFlags & MY_WME) - my_error(EE_CANT_COPY_OWNERSHIP, MYF(ME_JUST_WARNING), to, errno); + my_error(EE_CANT_COPY_OWNERSHIP, MYF(ME_BELL+ME_WAITTANG), to, errno); if (MyFlags & MY_FAE) goto err; } diff --git a/mysys/my_error.c b/mysys/my_error.c index a682585a82e..48b907d48cb 100644 --- a/mysys/my_error.c +++ b/mysys/my_error.c @@ -150,29 +150,6 @@ void my_printv_error(uint error, const char *format, myf MyFlags, va_list ap) /* - Error with va_list - - SYNOPSIS - my_printv_error() - error Errno - format Format string - MyFlags Flags - ... variable list -*/ - -int my_printv_error(uint error, const char *format, myf MyFlags, va_list ap) -{ - char ebuff[ERRMSGSIZE+20]; - DBUG_ENTER("my_printv_error"); - DBUG_PRINT("my", ("nr: %d MyFlags: %d errno: %d format: %s", - error, MyFlags, errno, format)); - - (void) my_vsnprintf(ebuff, sizeof(ebuff), format, ap); - DBUG_RETURN((*error_handler_hook)(error, ebuff, MyFlags)); -} - - -/* Give message using error_handler_hook SYNOPSIS diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index a13ba364594..74c0d6b5ba3 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -157,7 +157,7 @@ int handle_options(int *argc, char ***argv, my_bool end_of_options= 0, must_be_var, set_maximum_value, option_is_loose; char **pos, **pos_end, *optend, *opt_str, key_name[FN_REFLEN]; - const char *prev_found; + const char *UNINIT_VAR(prev_found); const struct my_option *optp; void *value; int error, i; @@ -228,7 +228,6 @@ int handle_options(int *argc, char ***argv, Find first the right option. Return error in case of an ambiguous, or unknown option */ - LINT_INIT(prev_found); optp= longopts; if (!(opt_found= findopt(opt_str, length, &optp, &prev_found))) { @@ -544,7 +543,8 @@ int handle_options(int *argc, char ***argv, (*argc)--; /* option handled (short), decrease argument count */ continue; } - if ((error= setval(optp, value, argument, set_maximum_value))) + if (((error= setval(optp, value, argument, set_maximum_value))) && + !option_is_loose) return error; if (get_one_option && get_one_option(optp->id, optp, argument)) return EXIT_UNSPECIFIED_ERROR; @@ -1009,6 +1009,7 @@ ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp, my_getopt_error_reporter(WARNING_LEVEL, "option '%s': unsigned value %s adjusted to %s", optp->name, ullstr(old, buf1), ullstr(num, buf2)); + return num; } diff --git a/mysys/my_handler.c b/mysys/my_handler.c index 8daa9af39a9..2cbe65bebba 100644 --- a/mysys/my_handler.c +++ b/mysys/my_handler.c @@ -22,8 +22,6 @@ #include <my_sys.h> #include "my_handler_errors.h" -#define CMP_NUM(a,b) (((a) < (b)) ? -1 : ((a) == (b)) ? 0 : 1) - int ha_compare_text(CHARSET_INFO *charset_info, const uchar *a, uint a_length, const uchar *b, uint b_length, my_bool part_key, my_bool skip_end_space) diff --git a/mysys/my_init.c b/mysys/my_init.c index 71b3d960386..ae4aa5bb5b7 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -96,10 +96,10 @@ my_bool my_basic_init(void) if (my_progname) my_progname_short= my_progname + dirname_length(my_progname); +#if defined(THREAD) /* Initalize our mutex handling */ my_mutex_init(); -#if defined(THREAD) if (my_thread_global_init()) return 1; #if defined(HAVE_PTHREAD_INIT) diff --git a/mysys/my_safehash.c b/mysys/my_safehash.c index 7ffb6d82e53..08c94a1d7c8 100644 --- a/mysys/my_safehash.c +++ b/mysys/my_safehash.c @@ -101,7 +101,7 @@ my_bool safe_hash_init(SAFE_HASH *hash, uint elements, { DBUG_ENTER("safe_hash_init"); if (my_hash_init(&hash->hash, &my_charset_bin, elements, - 0, 0, (hash_get_key) safe_hash_entry_get, + 0, 0, (my_hash_get_key) safe_hash_entry_get, (void (*)(void*)) safe_hash_entry_free, 0)) { hash->default_value= 0; diff --git a/mysys/my_static.c b/mysys/my_static.c index 97af25cf92d..c6bf3c0ef0f 100644 --- a/mysys/my_static.c +++ b/mysys/my_static.c @@ -88,19 +88,6 @@ static const char *proc_info_dummy(void *a __attribute__((unused)), /* this is to be able to call set_thd_proc_info from the C code */ const char *(*proc_info_hook)(void *, const char *, const char *, const char *, const unsigned int)= proc_info_dummy; - -static const char *proc_info_dummy(void *a __attribute__((unused)), - const char *b __attribute__((unused)), - const char *c __attribute__((unused)), - const char *d __attribute__((unused)), - const unsigned int e __attribute__((unused))) -{ - return 0; -} - -/* this is to be able to call set_thd_proc_info from the C code */ -const char *(*proc_info_hook)(void *, const char *, const char *, const char *, - const unsigned int)= proc_info_dummy; #if defined(ENABLED_DEBUG_SYNC) /** Global pointer to be set if callback function is defined diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 7b895149d84..a2d89c79b4e 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -391,10 +391,7 @@ void my_thread_end(void) mysql_cond_destroy(&tmp->suspend); #endif mysql_mutex_destroy(&tmp->mutex); - TRASH(tmp, sizeof(*tmp)); - free(tmp); -#warning why monty added pthread_setspecific(THR_KEY_mysys,0) here? /* Decrement counter for number of running threads. We are using this in my_thread_global_end() to wait until all threads have called @@ -406,6 +403,9 @@ void my_thread_end(void) if (--THR_thread_count == 0) mysql_cond_signal(&THR_COND_threads); mysql_mutex_unlock(&THR_LOCK_threads); + + TRASH(tmp, sizeof(*tmp)); + free(tmp); } pthread_setspecific(THR_KEY_mysys,0); } diff --git a/mysys/my_wincond.c b/mysys/my_wincond.c index 4d8ff6254e3..ad1636011db 100644 --- a/mysys/my_wincond.c +++ b/mysys/my_wincond.c @@ -18,7 +18,6 @@ *****************************************************************************/ #if defined(_WIN32) -#warning #include <my_global.h> #undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */ #include "mysys_priv.h" #include <m_string.h> diff --git a/mysys/my_winthread.c b/mysys/my_winthread.c index 1ca32d58832..19d4a707062 100644 --- a/mysys/my_winthread.c +++ b/mysys/my_winthread.c @@ -18,7 +18,7 @@ *****************************************************************************/ #if defined (_WIN32) /* SAFE_MUTEX will not work until the thread structure is up to date */ -#warning #include <my_global.h> + #undef SAFE_MUTEX #include "mysys_priv.h" #include <process.h> diff --git a/mysys/mysys_priv.h b/mysys/mysys_priv.h index 30ffac0ac77..772e0346016 100644 --- a/mysys/mysys_priv.h +++ b/mysys/mysys_priv.h @@ -85,7 +85,6 @@ extern PSI_file_key key_file_charset, key_file_cnf; #endif void my_error_unregister_all(void); -<<<<<<< TREE #ifdef _WIN32 #include <sys/stat.h> diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index 10607822ac0..9742861db08 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -230,7 +230,7 @@ my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data) abort: if (alarm_data->malloced) - my_free(alarm_data, MYF(0)); + my_free(alarm_data); mysql_mutex_unlock(&LOCK_alarm); one_signal_hand_sigmask(SIG_SETMASK,&old_mask,NULL); abort_no_unlock: diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c index 135a2a5618f..b22823ae33e 100644 --- a/mysys/thr_lock.c +++ b/mysys/thr_lock.c @@ -117,26 +117,16 @@ static inline mysql_cond_t *get_cond(void) return &my_thread_var->suspend; } +static inline int LOCK_CMP(THR_LOCK_DATA *a, THR_LOCK_DATA *b) +{ + if (a->lock != b->lock) + return a->lock < b->lock; -/* - Priority for locks (decides in which order locks are locked) - We want all write locks to be first, followed by read locks. - Locks from MERGE tables has a little lower priority than other - locks, to allow one to release merge tables without having - to unlock and re-lock other locks. - The lower the number, the higher the priority for the lock. - Read locks should have 4, write locks should have 0. - UNLOCK is 8, to force these last in thr_merge_locks. - For MERGE tables we add 2 (THR_LOCK_MERGE_PRIV) to the lock priority. - THR_LOCK_LATE_PRIV (1) is used when one locks other tables to be merged - with existing locks. This way we prioritize the original locks over the - new locks. -*/ - -static uint lock_priority[(uint)TL_WRITE_ONLY+1] = -{ 8, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0}; + if (a->type != b->type) + return a->type > b->type; -#define LOCK_CMP(A,B) ((uchar*) ((A)->lock) + lock_priority[(uint) (A)->type] + (A)->priority < (uchar*) ((B)->lock) + lock_priority[(uint) (B)->type] + (B)->priority) + return a->priority < b->priority; +} /* diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c index bd53ee433e8..b5548662679 100644 --- a/mysys/thr_mutex.c +++ b/mysys/thr_mutex.c @@ -171,12 +171,12 @@ static int safe_mutex_lazy_init_deadlock_detection(safe_mutex_t *mp) pthread_mutex_lock(&THR_LOCK_mutex); mp->id= ++safe_mutex_id; pthread_mutex_unlock(&THR_LOCK_mutex); - hash_init(mp->locked_mutex, &my_charset_bin, + my_hash_init(mp->locked_mutex, &my_charset_bin, 1000, offsetof(safe_mutex_deadlock_t, id), sizeof(mp->id), 0, 0, HASH_UNIQUE); - hash_init(mp->used_mutex, &my_charset_bin, + my_hash_init(mp->used_mutex, &my_charset_bin, 1000, offsetof(safe_mutex_t, id), sizeof(mp->id), @@ -186,10 +186,7 @@ static int safe_mutex_lazy_init_deadlock_detection(safe_mutex_t *mp) int safe_mutex_init(safe_mutex_t *mp, const pthread_mutexattr_t *attr __attribute__((unused)), - const char *name, - myf my_flags, - const char *file, - uint line) + const char *name, const char *file, uint line) { DBUG_ENTER("safe_mutex_init"); DBUG_PRINT("enter",("mutex: 0x%lx name: %s", (ulong) mp, name)); @@ -202,11 +199,9 @@ int safe_mutex_init(safe_mutex_t *mp, /* Skip the very common '&' prefix from the autogenerated name */ mp->name= name[0] == '&' ? name + 1 : name; - if (!safe_mutex_deadlock_detector) - my_flags|= MYF_NO_DEADLOCK_DETECTION; /* Deadlock detection is initialised only lazily, on first use. */ - mp->create_flags= my_flags; + mp->create_flags= safe_mutex_deadlock_detector ? MYF_NO_DEADLOCK_DETECTION : 0; #ifdef SAFE_MUTEX_DETECT_DESTROY /* @@ -342,7 +337,7 @@ int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file, */ pthread_mutex_lock(&THR_LOCK_mutex); - if (!hash_search(mutex_root->locked_mutex, (uchar*) &mp->id, 0)) + if (!my_hash_search(mutex_root->locked_mutex, (uchar*) &mp->id, 0)) { safe_mutex_deadlock_t *deadlock; safe_mutex_t *mutex; @@ -362,7 +357,7 @@ int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file, mutex= mutex_root; do { - if (hash_search(mp->locked_mutex, (uchar*) &mutex->id, 0)) + if (my_hash_search(mp->locked_mutex, (uchar*) &mutex->id, 0)) { print_deadlock_warning(mp, mutex); /* Mark wrong usage to avoid future warnings for same error */ @@ -669,9 +664,9 @@ void safe_mutex_free_deadlock_data(safe_mutex_t *mp) mp); pthread_mutex_unlock(&THR_LOCK_mutex); - hash_free(mp->used_mutex); - hash_free(mp->locked_mutex); - my_free(mp->locked_mutex, 0); + my_hash_free(mp->used_mutex); + my_hash_free(mp->locked_mutex); + my_free(mp->locked_mutex); mp->create_flags|= MYF_NO_DEADLOCK_DETECTION; } } @@ -718,8 +713,7 @@ void safe_mutex_end(FILE *file __attribute__((unused))) safe_mutex_t **my_thread_var_mutex_in_use() { - struct st_my_thread_var *tmp= - my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys); + struct st_my_thread_var *tmp= my_thread_var; return tmp ? &tmp->mutex_in_use : 0; } @@ -785,17 +779,17 @@ static my_bool remove_from_locked_mutex(safe_mutex_t *mp, (ulong) delete_mutex, (ulong) mp, delete_mutex->id, mp->id)); - found= (safe_mutex_deadlock_t *) hash_search(mp->locked_mutex, + found= (safe_mutex_deadlock_t *) my_hash_search(mp->locked_mutex, (uchar*) &delete_mutex->id, 0); DBUG_ASSERT(found); if (found) { - if (hash_delete(mp->locked_mutex, (uchar*) found)) + if (my_hash_delete(mp->locked_mutex, (uchar*) found)) { DBUG_ASSERT(0); } if (!--found->count) - my_free(found, MYF(0)); + my_free(found); } DBUG_RETURN(0); } @@ -807,12 +801,12 @@ static my_bool remove_from_used_mutex(safe_mutex_deadlock_t *locked_mutex, DBUG_PRINT("enter", ("delete_mutex: 0x%lx mutex: 0x%lx (id: %lu <- %lu)", (ulong) mutex, (ulong) locked_mutex, mutex->id, locked_mutex->id)); - if (hash_delete(locked_mutex->mutex->used_mutex, (uchar*) mutex)) + if (my_hash_delete(locked_mutex->mutex->used_mutex, (uchar*) mutex)) { DBUG_ASSERT(0); } if (!--locked_mutex->count) - my_free(locked_mutex, MYF(0)); + my_free(locked_mutex); DBUG_RETURN(0); } diff --git a/mysys/wqueue.c b/mysys/wqueue.c index fcc0a39725d..b6f52ba5c31 100644 --- a/mysys/wqueue.c +++ b/mysys/wqueue.c @@ -130,7 +130,7 @@ void wqueue_release_queue(WQUEUE *wqueue) do { thread= next; - pthread_cond_signal(&thread->suspend); + mysql_cond_signal(&thread->suspend); next= thread->next; thread->next= NULL; } @@ -158,7 +158,7 @@ void wqueue_release_one_locktype_from_queue(WQUEUE *wqueue) if (first_type == MY_PTHREAD_LOCK_WRITE) { /* release first waiting for write lock */ - pthread_cond_signal(&next->suspend); + mysql_cond_signal(&next->suspend); if (next == last) wqueue->last_thread= NULL; else @@ -184,7 +184,7 @@ void wqueue_release_one_locktype_from_queue(WQUEUE *wqueue) else { /* release waiting for read lock */ - pthread_cond_signal(&thread->suspend); + mysql_cond_signal(&thread->suspend); thread->next= NULL; } } while (thread != last); @@ -204,7 +204,7 @@ void wqueue_release_one_locktype_from_queue(WQUEUE *wqueue) void wqueue_add_and_wait(WQUEUE *wqueue, struct st_my_thread_var *thread, - pthread_mutex_t *lock) + mysql_mutex_t *lock) { DBUG_ENTER("wqueue_add_and_wait"); DBUG_PRINT("enter", @@ -215,7 +215,7 @@ void wqueue_add_and_wait(WQUEUE *wqueue, { DBUG_PRINT("info", ("wait... cond: 0x%lx mutex: 0x%lx", (ulong) &thread->suspend, (ulong) lock)); - pthread_cond_wait(&thread->suspend, lock); + mysql_cond_wait(&thread->suspend, lock); DBUG_PRINT("info", ("wait done cond: 0x%lx mutex: 0x%lx next: 0x%lx", (ulong) &thread->suspend, (ulong) lock, (ulong) thread->next)); |