summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-08-24 18:00:45 +0300
committerunknown <monty@mysql.com>2004-08-24 18:00:45 +0300
commit20f24a422bd8ff8747c2e75c03b9f207875ad880 (patch)
tree0889ac56857787d5328320949bb6d8339acf6407 /sql/sql_class.cc
parent4e7cb1ce4892a025de932fe969676a1131e004b4 (diff)
downloadmariadb-git-20f24a422bd8ff8747c2e75c03b9f207875ad880.tar.gz
Portablity fixes & simple optimizations
sql/ha_ndbcluster.cc: Added missing cast sql/item.cc: Portability fix (for windows) sql/lock.cc: Cleanup + more comments sql/sql_class.cc: Portability fix + more comments sql/sql_select.cc: Portability fix sql/sql_table.cc: Simpler handling of auto_increment in ALTER TABLE
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 23fef44c964..e49cfecba9d 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -155,11 +155,13 @@ bool foreign_key_prefix(Key *a, Key *b)
** Thread specific functions
****************************************************************************/
-THD::THD():user_time(0), current_arena(this), is_fatal_error(0),
- last_insert_id_used(0),
- insert_id_used(0), rand_used(0), time_zone_used(0),
- in_lock_tables(0), global_read_lock(0), bootstrap(0)
+THD::THD()
+ :user_time(0), global_read_lock(0), is_fatal_error(0),
+ last_insert_id_used(0),
+ insert_id_used(0), rand_used(0), time_zone_used(0),
+ in_lock_tables(0), bootstrap(0)
{
+ current_arena= this;
host= user= priv_user= db= ip=0;
host_or_ip= "connecting host";
locked=some_tables_deleted=no_errors=password= 0;
@@ -439,10 +441,13 @@ void THD::awake(bool prepare_to_die)
it is the true value but maybe current_mutex is not yet non-zero (we're
in the middle of enter_cond() and there is a "memory order
inversion"). So we test the mutex too to not lock 0.
+
Note that there is a small chance we fail to kill. If victim has locked
- current_mutex, and hasn't entered enter_cond(), then we don't know it's
- going to wait on cond. Then victim goes into its cond "forever" (until
- we issue a second KILL). True we have set its thd->killed but it may not
+ current_mutex, but hasn't yet entered enter_cond() (which means that
+ current_cond and current_mutex are 0), then the victim will not get
+ a signal and it may wait "forever" on the cond (until
+ we issue a second KILL or the status it's waiting for happens).
+ It's true that we have set its thd->killed but it may not
see it immediately and so may have time to reach the cond_wait().
*/
if (mysys_var->current_cond && mysys_var->current_mutex)