Commit e7e243ed authored by unknown's avatar unknown

Changed pthread_mutex_init() to use new MY_MUTEX_INIT.. macro

(For glibc 2.2)


client/thread_test.c:
  Changed pthread_mutex_init() to use new MY_MUTEX_INIT.. macro
dbug/dbug.c:
  Changed pthread_mutex_init() to use new MY_MUTEX_INIT.. macro
heap/hp_open.c:
  Changed pthread_mutex_init() to use new MY_MUTEX_INIT.. macro
isam/open.c:
  Changed pthread_mutex_init() to use new MY_MUTEX_INIT.. macro
myisam/mi_open.c:
  Changed pthread_mutex_init() to use new MY_MUTEX_INIT.. macro
mysys/thr_alarm.c:
  Changed pthread_mutex_init() to use new MY_MUTEX_INIT.. macro
mysys/thr_lock.c:
  Changed pthread_mutex_init() to use new MY_MUTEX_INIT.. macro
mysys/thr_rwlock.c:
  Changed pthread_mutex_init() to use new MY_MUTEX_INIT.. macro
sql/ha_berkeley.cc:
  Changed pthread_mutex_init() to use new MY_MUTEX_INIT.. macro
sql/ha_innobase.cc:
  Changed pthread_mutex_init() to use new MY_MUTEX_INIT.. macro
sql/hash_filo.h:
  Changed pthread_mutex_init() to use new MY_MUTEX_INIT.. macro
sql/hostname.cc:
  Changed pthread_mutex_init() to use new MY_MUTEX_INIT.. macro
sql/item_func.cc:
  Changed pthread_mutex_init() to use new MY_MUTEX_INIT.. macro
sql/log.cc:
  Changed pthread_mutex_init() to use new MY_MUTEX_INIT.. macro
sql/mysqld.cc:
  Changed pthread_mutex_init() to use new MY_MUTEX_INIT.. macro
sql/slave.h:
  Changed pthread_mutex_init() to use new MY_MUTEX_INIT.. macro
sql/sql_class.cc:
  Changed pthread_mutex_init() to use new MY_MUTEX_INIT.. macro
sql/sql_class.h:
  Changed pthread_mutex_init() to use new MY_MUTEX_INIT.. macro
sql/sql_insert.cc:
  Changed pthread_mutex_init() to use new MY_MUTEX_INIT.. macro
sql/sql_udf.cc:
  Changed pthread_mutex_init() to use new MY_MUTEX_INIT.. macro
parent 92d00094
......@@ -229,7 +229,7 @@ int main(int argc, char **argv)
error,errno);
exit(1);
}
pthread_mutex_init(&LOCK_thread_count,NULL);
pthread_mutex_init(&LOCK_thread_count,MY_MUTEX_INIT_FAST);
if ((error=pthread_attr_init(&thr_attr)))
{
......
......@@ -341,7 +341,7 @@ pthread_mutex_t THR_LOCK_dbug;
static void init_dbug_state(void)
{
pthread_mutex_init(&THR_LOCK_dbug,NULL);
pthread_mutex_init(&THR_LOCK_dbug,MY_MUTEX_INIT_FAST);
}
static CODE_STATE *code_state(void)
......
......@@ -88,7 +88,7 @@ HP_INFO *heap_open(const char *name, int mode, uint keys, HP_KEYDEF *keydef,
}
#ifdef THREAD
thr_lock_init(&share->lock);
VOID(pthread_mutex_init(&share->intern_lock,NULL));
VOID(pthread_mutex_init(&share->intern_lock,MY_MUTEX_INIT_FAST));
#endif
share->open_list.data=(void*) share;
heap_share_list=list_add(heap_share_list,&share->open_list);
......
......@@ -270,7 +270,7 @@ N_INFO *nisam_open(const char *name, int mode, uint handle_locking)
setup_functions(share);
#ifdef THREAD
thr_lock_init(&share->lock);
VOID(pthread_mutex_init(&share->intern_lock,NULL));
VOID(pthread_mutex_init(&share->intern_lock,MY_MUTEX_INIT_FAST));
#endif
}
else
......
......@@ -393,7 +393,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
setup_functions(share);
#ifdef THREAD
thr_lock_init(&share->lock);
VOID(pthread_mutex_init(&share->intern_lock,NULL));
VOID(pthread_mutex_init(&share->intern_lock,MY_MUTEX_INIT_FAST));
for (i=0; i<keys; i++)
VOID(my_rwlock_init(&share->key_root_lock[i], NULL));
if (!thr_lock_inited)
......
......@@ -71,7 +71,7 @@ void init_thr_alarm(uint max_alarms)
init_queue(&alarm_queue,max_alarms+1,offsetof(ALARM,expire_time),0,
compare_ulong,NullS);
sigfillset(&full_signal_set); /* Neaded to block signals */
pthread_mutex_init(&LOCK_alarm,NULL);
pthread_mutex_init(&LOCK_alarm,MY_MUTEX_INIT_FAST);
#if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD)
#if defined(HAVE_mit_thread)
sigset(THR_CLIENT_ALARM,thread_alarm); /* int. thread system calls */
......@@ -862,7 +862,7 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
if (argc > 1 && argv[1][0] == '-' && argv[1][1] == '#')
DBUG_PUSH(argv[1]+2);
pthread_mutex_init(&LOCK_thread_count,NULL);
pthread_mutex_init(&LOCK_thread_count,MY_MUTEX_INIT_FAST);
pthread_cond_init(&COND_thread_count,NULL);
/* Start a alarm handling thread */
......
......@@ -288,7 +288,7 @@ void thr_lock_init(THR_LOCK *lock)
{
DBUG_ENTER("thr_lock_init");
bzero((char*) lock,sizeof(*lock));
VOID(pthread_mutex_init(&lock->mutex,NULL));
VOID(pthread_mutex_init(&lock->mutex,MY_MUTEX_INIT_FAST));
lock->read.last= &lock->read.data;
lock->read_wait.last= &lock->read_wait.data;
lock->write_wait.last= &lock->write_wait.data;
......@@ -1218,7 +1218,7 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
error,errno);
exit(1);
}
if ((error=pthread_mutex_init(&LOCK_thread_count,NULL)))
if ((error=pthread_mutex_init(&LOCK_thread_count,MY_MUTEX_INIT_FAST)))
{
fprintf(stderr,"Got error: %d from pthread_cond_init (errno: %d)",
error,errno);
......
......@@ -63,7 +63,7 @@ int my_rwlock_init( rw_lock_t *rwp, void *arg __attribute__((unused)))
{
pthread_condattr_t cond_attr;
pthread_mutex_init( &rwp->lock, NULL );
pthread_mutex_init( &rwp->lock, MY_MUTEX_INIT_FAST);
pthread_condattr_init( &cond_attr );
pthread_cond_init( &rwp->readers, &cond_attr );
pthread_cond_init( &rwp->writers, &cond_attr );
......
......@@ -171,7 +171,7 @@ bool berkeley_init(void)
(void) hash_init(&bdb_open_tables,32,0,0,
(hash_get_key) bdb_get_key,0,0);
pthread_mutex_init(&bdb_mutex,NULL);
pthread_mutex_init(&bdb_mutex,MY_MUTEX_INIT_FAST);
DBUG_RETURN(db_env == 0);
}
......@@ -2151,7 +2151,7 @@ static BDB_SHARE *get_share(const char *table_name, TABLE *table)
return 0; /* purecov: inspected */
}
thr_lock_init(&share->lock);
pthread_mutex_init(&share->mutex,NULL);
pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST);
}
}
pthread_mutex_unlock(&bdb_mutex);
......
......@@ -476,7 +476,7 @@ innobase_init(void)
}
(void) hash_init(&innobase_open_tables,32,0,0,
(hash_get_key) innobase_get_key,0,0);
pthread_mutex_init(&innobase_mutex,NULL);
pthread_mutex_init(&innobase_mutex,MY_MUTEX_INIT_FAST);
DBUG_RETURN(0);
}
......@@ -2642,7 +2642,7 @@ static INNOBASE_SHARE *get_share(const char *table_name)
return 0;
}
thr_lock_init(&share->lock);
pthread_mutex_init(&share->mutex,NULL);
pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST);
}
}
share->use_count++;
......
......@@ -70,7 +70,7 @@ class hash_filo
if (!init)
{
init=1;
(void) pthread_mutex_init(&lock,NULL);
(void) pthread_mutex_init(&lock,MY_MUTEX_INIT_FAST);
}
if (!locked)
(void) pthread_mutex_lock(&lock);
......
......@@ -57,7 +57,7 @@ void hostname_cache_refresh()
bool hostname_cache_init()
{
(void) pthread_mutex_init(&LOCK_hostname,NULL);
(void) pthread_mutex_init(&LOCK_hostname,MY_MUTEX_INIT_SLOW);
if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE,offsetof(host_entry,ip),
sizeof(struct in_addr),NULL,
(void (*)(void*)) free)))
......
......@@ -1370,7 +1370,7 @@ char *ull_get_key(const ULL *ull,uint *length,
void item_user_lock_init(void)
{
pthread_mutex_init(&LOCK_user_locks,NULL);
pthread_mutex_init(&LOCK_user_locks,MY_MUTEX_INIT_SLOW);
hash_init(&hash_user_locks,16,0,0,(hash_get_key) ull_get_key,NULL,0);
}
......
......@@ -141,8 +141,8 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
if (!inited)
{
inited=1;
(void) pthread_mutex_init(&LOCK_log,NULL);
(void) pthread_mutex_init(&LOCK_index, NULL);
(void) pthread_mutex_init(&LOCK_log,MY_MUTEX_INIT_SLOW);
(void) pthread_mutex_init(&LOCK_index, MY_MUTEX_INIT_SLOW);
if (log_type_arg == LOG_BIN && *fn_ext(log_name))
no_rotate = 1;
}
......
......@@ -1568,31 +1568,31 @@ int main(int argc, char **argv)
/* These must be set early */
(void) pthread_mutex_init(&LOCK_mysql_create_db,MY_MUTEX_INIT_SLOW);
(void) pthread_mutex_init(&LOCK_Acl,MY_MUTEX_INIT_SLOW);
(void) pthread_mutex_init(&LOCK_grant,MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_open,MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_thread_count,MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_mapped_file,MY_MUTEX_INIT_SLOW);
(void) pthread_mutex_init(&LOCK_status,MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_error_log,MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_delayed_insert,MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_delayed_status,MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_delayed_create,MY_MUTEX_INIT_SLOW);
(void) pthread_mutex_init(&LOCK_manager,MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_crypt,MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_bytes_sent,MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_bytes_received,MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_timezone,MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_binlog_update, MY_MUTEX_INIT_FAST); // QQ NOT USED
(void) pthread_mutex_init(&LOCK_slave, MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_server_id, MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_user_conn, MY_MUTEX_INIT_FAST);
(void) pthread_cond_init(&COND_thread_count,NULL);
(void) pthread_mutex_init(&LOCK_mysql_create_db,NULL);
(void) pthread_mutex_init(&LOCK_Acl,NULL);
(void) pthread_mutex_init(&LOCK_grant,NULL);
(void) pthread_mutex_init(&LOCK_open,NULL);
(void) pthread_mutex_init(&LOCK_thread_count,NULL);
(void) pthread_mutex_init(&LOCK_mapped_file,NULL);
(void) pthread_mutex_init(&LOCK_status,NULL);
(void) pthread_mutex_init(&LOCK_error_log,NULL);
(void) pthread_mutex_init(&LOCK_delayed_insert,NULL);
(void) pthread_mutex_init(&LOCK_delayed_status,NULL);
(void) pthread_mutex_init(&LOCK_delayed_create,NULL);
(void) pthread_cond_init(&COND_refresh,NULL);
(void) pthread_cond_init(&COND_thread_cache,NULL);
(void) pthread_cond_init(&COND_flush_thread_cache,NULL);
(void) pthread_cond_init(&COND_manager,NULL);
(void) pthread_mutex_init(&LOCK_manager,NULL);
(void) pthread_mutex_init(&LOCK_crypt,NULL);
(void) pthread_mutex_init(&LOCK_bytes_sent,NULL);
(void) pthread_mutex_init(&LOCK_bytes_received,NULL);
(void) pthread_mutex_init(&LOCK_timezone,NULL);
(void) pthread_mutex_init(&LOCK_binlog_update, NULL);
(void) pthread_mutex_init(&LOCK_slave, NULL);
(void) pthread_mutex_init(&LOCK_server_id, NULL);
(void) pthread_mutex_init(&LOCK_user_conn, NULL);
(void) pthread_cond_init(&COND_binlog_update, NULL);
(void) pthread_cond_init(&COND_slave_stopped, NULL);
(void) pthread_cond_init(&COND_slave_start, NULL);
......
......@@ -20,7 +20,7 @@ typedef struct st_master_info
st_master_info():pending(0),fd(-1),inited(0)
{
host[0] = 0; user[0] = 0; password[0] = 0;
pthread_mutex_init(&lock, NULL);
pthread_mutex_init(&lock, MY_MUTEX_INIT_FAST);
pthread_cond_init(&cond, NULL);
}
......
......@@ -110,7 +110,7 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0),
#endif
#ifdef SIGNAL_WITH_VIO_CLOSE
active_vio = 0;
pthread_mutex_init(&active_vio_lock, NULL);
pthread_mutex_init(&active_vio_lock, MY_MUTEX_INIT_FAST);
#endif
/* Variables with default values */
......
......@@ -45,7 +45,7 @@ typedef struct st_log_info
my_off_t pos;
bool fatal; // if the purge happens to give us a negative offset
pthread_mutex_t lock;
st_log_info():fatal(0) { pthread_mutex_init(&lock, NULL);}
st_log_info():fatal(0) { pthread_mutex_init(&lock, MY_MUTEX_INIT_FAST);}
~st_log_info() { pthread_mutex_destroy(&lock);}
} LOG_INFO;
......
......@@ -498,7 +498,7 @@ class delayed_insert :public ilink {
bzero((char*) &thd.net,sizeof(thd.net)); // Safety
thd.system_thread=1;
bzero((char*) &info,sizeof(info));
pthread_mutex_init(&mutex,NULL);
pthread_mutex_init(&mutex,MY_MUTEX_INIT_FAST);
pthread_cond_init(&cond,NULL);
pthread_cond_init(&cond_client,NULL);
VOID(pthread_mutex_lock(&LOCK_thread_count));
......
......@@ -105,7 +105,7 @@ void udf_init()
if (initialized)
DBUG_VOID_RETURN;
pthread_mutex_init(&THR_LOCK_udf,NULL);
pthread_mutex_init(&THR_LOCK_udf,MY_MUTEX_INIT_SLOW);
init_sql_alloc(&mem, 1024,0);
THD *new_thd = new THD;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment