null+****@clear*****
null+****@clear*****
2011年 6月 8日 (水) 10:55:13 JST
Kouhei Sutou 2011-06-08 01:55:13 +0000 (Wed, 08 Jun 2011)
New Revision: 9219f87865daf2e60089595a167d0fe426d59c9e
Log:
unify mutex for open API change between MySQL 5.0 and 5.5.
Modified files:
ha_mroonga.cc
Modified: ha_mroonga.cc (+3 -18)
===================================================================
--- ha_mroonga.cc 2011-06-08 01:46:39 +0000 (2416469)
+++ ha_mroonga.cc 2011-06-08 01:55:13 +0000 (d595915)
@@ -64,6 +64,8 @@
extern mysql_mutex_t LOCK_open;
#else
extern pthread_mutex_t LOCK_open;
+# define mysql_mutex_lock(mutex) pthread_mutex_lock(mutex)
+# define mysql_mutex_unlock(mutex) pthread_mutex_unlock(mutex)
#endif
#ifdef __cplusplus
@@ -1461,25 +1463,16 @@ int ha_mroonga::delete_table(const char *name)
#if MYSQL_VERSION_ID >= 50500
table_list.init_one_table(db_name, strlen(db_name),
tbl_name, strlen(tbl_name), tbl_name, TL_WRITE);
- mysql_mutex_lock(&LOCK_open);
#else
table_list.init_one_table(db_name, tbl_name, TL_WRITE);
- pthread_mutex_lock(&LOCK_open);
#endif
+ mysql_mutex_lock(&LOCK_open);
if (!(tmp_table_share = mrn_get_table_share(&table_list, &error)))
{
-#if MYSQL_VERSION_ID >= 50500
mysql_mutex_unlock(&LOCK_open);
-#else
- pthread_mutex_unlock(&LOCK_open);
-#endif
DBUG_RETURN(error);
}
-#if MYSQL_VERSION_ID >= 50500
mysql_mutex_unlock(&LOCK_open);
-#else
- pthread_mutex_unlock(&LOCK_open);
-#endif
tmp_table.s = tmp_table_share;
tmp_table.part_info = NULL;
if (!(tmp_share = mrn_get_share(name, &tmp_table, &error)))
@@ -1496,17 +1489,9 @@ int ha_mroonga::delete_table(const char *name)
}
mrn_free_share(tmp_share);
-#if MYSQL_VERSION_ID >= 50500
mysql_mutex_lock(&LOCK_open);
-#else
- pthread_mutex_lock(&LOCK_open);
-#endif
mrn_free_table_share(tmp_table_share);
-#if MYSQL_VERSION_ID >= 50500
mysql_mutex_unlock(&LOCK_open);
-#else
- pthread_mutex_unlock(&LOCK_open);
-#endif
DBUG_RETURN(error);
}