From: Date: July 25 2005 6:34pm Subject: bk commit into 4.1 tree (bar:1.2347) BUG#12109 List-Archive: http://lists.mysql.com/internals/27559 X-Bug: 12109 Message-Id: <200507251634.j6PGYXPf024941@bar.intranet.mysql.r18.ru> Below is the list of changes that have just been committed into a local 4.1 repository of bar. When bar does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2347 05/07/25 21:34:20 bar@stripped +1 -0 charset.c: Bug#12109 possible locking bug in init_available_charset Recheck charset_initialized inside locked code, to garantee two threads are not entering consequently. mysys/charset.c 1.136 05/07/25 21:32:40 bar@stripped +18 -16 Bug#12109 possible locking bug in init_available_charset Recheck charset_initialized inside locked code, to garantee two threads are not entering consequently. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: bar # Host: bar.intranet.mysql.r18.ru # Root: /usr/home/bar/mysql-4.1.b12109 --- 1.135/mysys/charset.c 2005-02-22 16:37:07 +04:00 +++ 1.136/mysys/charset.c 2005-07-25 21:32:40 +05:00 @@ -383,26 +383,28 @@ while we may changing the cs_info_table */ pthread_mutex_lock(&THR_LOCK_charset); - - bzero(&all_charsets,sizeof(all_charsets)); - init_compiled_charsets(myflags); - - /* Copy compiled charsets */ - for (cs=all_charsets; - cs < all_charsets+array_elements(all_charsets)-1 ; - cs++) + if (!charset_initialized) { - if (*cs) + bzero(&all_charsets,sizeof(all_charsets)); + init_compiled_charsets(myflags); + + /* Copy compiled charsets */ + for (cs=all_charsets; + cs < all_charsets+array_elements(all_charsets)-1 ; + cs++) { - if (cs[0]->ctype) - if (init_state_maps(*cs)) - *cs= NULL; + if (*cs) + { + if (cs[0]->ctype) + if (init_state_maps(*cs)) + *cs= NULL; + } } + + strmov(get_charsets_dir(fname), MY_CHARSET_INDEX); + error= my_read_charset_file(fname,myflags); + charset_initialized=1; } - - strmov(get_charsets_dir(fname), MY_CHARSET_INDEX); - error= my_read_charset_file(fname,myflags); - charset_initialized=1; pthread_mutex_unlock(&THR_LOCK_charset); } return error;