@@ -48,7 +48,7 @@ static inline uint get_ext_key_parts(const KEY *key) {
48
48
#endif // defined(TOKU_INCLUDE_EXTENDED_KEYS) && TOKU_INCLUDE_EXTENDED_KEYS
49
49
50
50
std::unordered_map<std::string, TOKUDB_SHARE*> TOKUDB_SHARE::_open_tables;
51
- tokudb::thread::mutex_t TOKUDB_SHARE::_open_tables_mutex;
51
+ tokudb::thread::mutex_t * TOKUDB_SHARE::_open_tables_mutex;
52
52
53
53
static const char * ha_tokudb_exts[] = {
54
54
ha_tokudb_ext,
@@ -154,6 +154,7 @@ static void free_key_and_col_info (KEY_AND_COL_INFO* kc_info) {
154
154
155
155
void TOKUDB_SHARE::static_init () {
156
156
assert_always (_open_tables.size () == 0 );
157
+ _open_tables_mutex = new tokudb::thread::mutex_t ();
157
158
}
158
159
void TOKUDB_SHARE::static_destroy () {
159
160
for (auto it = _open_tables.cbegin (); it != _open_tables.cend (); it++) {
@@ -164,6 +165,7 @@ void TOKUDB_SHARE::static_destroy() {
164
165
}
165
166
_open_tables.clear ();
166
167
assert_always (_open_tables.size () == 0 );
168
+ delete _open_tables_mutex;
167
169
}
168
170
const char * TOKUDB_SHARE::get_state_string (share_state_t state) {
169
171
static const char * state_string[] = {
@@ -218,7 +220,7 @@ TOKUDB_SHARE* TOKUDB_SHARE::get_share(const char* table_name,
218
220
THR_LOCK_DATA* data,
219
221
bool create_new) {
220
222
std::string find_table_name (table_name);
221
- mutex_t_lock (_open_tables_mutex);
223
+ mutex_t_lock (* _open_tables_mutex);
222
224
auto it = _open_tables.find (find_table_name);
223
225
TOKUDB_SHARE *share = nullptr ;
224
226
if (it != _open_tables.end ()) {
@@ -251,7 +253,7 @@ TOKUDB_SHARE* TOKUDB_SHARE::get_share(const char* table_name,
251
253
thr_lock_data_init (&(share->_thr_lock ), data, NULL );
252
254
253
255
exit:
254
- mutex_t_unlock (_open_tables_mutex);
256
+ mutex_t_unlock (* _open_tables_mutex);
255
257
return share;
256
258
}
257
259
void TOKUDB_SHARE::drop_share (TOKUDB_SHARE* share) {
@@ -262,12 +264,12 @@ void TOKUDB_SHARE::drop_share(TOKUDB_SHARE* share) {
262
264
get_state_string (share->_state ),
263
265
share->_use_count );
264
266
265
- mutex_t_lock (_open_tables_mutex);
267
+ mutex_t_lock (* _open_tables_mutex);
266
268
size_t n = _open_tables.erase (std::string (share->full_table_name ()));
267
269
assert_always (n == 1 );
268
270
share->destroy ();
269
271
delete share;
270
- mutex_t_unlock (_open_tables_mutex);
272
+ mutex_t_unlock (* _open_tables_mutex);
271
273
}
272
274
TOKUDB_SHARE::share_state_t TOKUDB_SHARE::addref () {
273
275
TOKUDB_SHARE_TRACE_FOR_FLAGS ((TOKUDB_DEBUG_ENTER & TOKUDB_DEBUG_SHARE),
0 commit comments