119
119
#define MY_CHARSET_INDEX "Index.xml"
121
121
const char *charsets_dir= NULL;
122
static int charset_initialized=0;
122
static bool charset_initialized= false;
125
125
char *get_charsets_dir(char *buf)
163
163
We have to use charset_initialized to not lock on THR_LOCK_charset
164
164
inside get_internal_charset...
166
if (!charset_initialized)
166
if (charset_initialized == false)
168
168
CHARSET_INFO **cs;
170
To make things thread safe we are not allowing other threads to interfere
171
while we may changing the cs_info_table
173
pthread_mutex_lock(&THR_LOCK_charset);
174
if (!charset_initialized)
169
memset(&all_charsets, 0, sizeof(all_charsets));
170
init_compiled_charsets(myflags);
172
/* Copy compiled charsets */
173
for (cs=all_charsets;
174
cs < all_charsets+array_elements(all_charsets)-1 ;
176
memset(&all_charsets, 0, sizeof(all_charsets));
177
init_compiled_charsets(myflags);
179
/* Copy compiled charsets */
180
for (cs=all_charsets;
181
cs < all_charsets+array_elements(all_charsets)-1 ;
187
if (init_state_maps(*cs))
180
if (init_state_maps(*cs))
192
strcpy(get_charsets_dir(fname), MY_CHARSET_INDEX);
193
charset_initialized=1;
195
pthread_mutex_unlock(&THR_LOCK_charset);
185
strcpy(get_charsets_dir(fname), MY_CHARSET_INDEX);
186
charset_initialized= true;
188
assert(charset_initialized);
201
194
void free_charsets(void)
203
charset_initialized=0;
196
charset_initialized= true;
248
241
To make things thread safe we are not allowing other threads to interfere
249
242
while we may changing the cs_info_table
251
pthread_mutex_lock(&THR_LOCK_charset);
252
244
if ((cs= all_charsets[cs_number]))
254
246
if (!(cs->state & MY_CS_COMPILED) && !(cs->state & MY_CS_LOADED))