summaryrefslogtreecommitdiff
path: root/sql/lock.cc
diff options
context:
space:
mode:
authorunknown <monty@work.mysql.com>2001-09-13 09:52:35 +0200
committerunknown <monty@work.mysql.com>2001-09-13 09:52:35 +0200
commitc96bf55b9c8641d4b1c2ece0c0314071bc1022df (patch)
tree1fb0fbca5b7a4edebe2c26a5ed0b272e92bc21f2 /sql/lock.cc
parent9e4206b990df875e063a07784c77cc39dc394654 (diff)
parentc88dd9b291cf7fe9086102d74d255f4b880d1486 (diff)
downloadmariadb-git-c96bf55b9c8641d4b1c2ece0c0314071bc1022df.tar.gz
Merge with 3.23.42
configure.in: Auto merged BitKeeper/deleted/.del-violite.c~d7b85be615595ace: Auto merged BitKeeper/deleted/.del-violite.c~984c09cffe14a11b: Auto merged client/Makefile.am: Auto merged client/mysql.cc: Auto merged client/mysqlbinlog.cc: Auto merged heap/hp_test2.c: Auto merged include/global.h: Auto merged include/my_pthread.h: Auto merged include/myisam.h: Auto merged libmysql/libmysql.c: Auto merged libmysql/net.c: Auto merged myisam/sort.c: Auto merged sql-bench/test-create.sh: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/lock.cc: Auto merged sql/log_event.cc: Auto merged sql/mini_client.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/net_serv.cc: Auto merged mysql-test/t/merge.test: Auto merged sql/ha_innobase.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_table.cc: Auto merged support-files/mysql.spec.sh: Auto merged mysql-test/t/bdb.test: Auto merged Docs/manual.texi: merge myisam/myisampack.c: merge
Diffstat (limited to 'sql/lock.cc')
-rw-r--r--sql/lock.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/sql/lock.cc b/sql/lock.cc
index 9ce4137e380..d9bc5d43c79 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -149,8 +149,10 @@ static int lock_external(TABLE **tables,uint count)
void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock)
{
DBUG_ENTER("mysql_unlock_tables");
- thr_multi_unlock(sql_lock->locks,sql_lock->lock_count);
- VOID(unlock_external(thd,sql_lock->table,sql_lock->table_count));
+ if (sql_lock->lock_count)
+ thr_multi_unlock(sql_lock->locks,sql_lock->lock_count);
+ if (sql_lock->table_count)
+ VOID(unlock_external(thd,sql_lock->table,sql_lock->table_count));
my_free((gptr) sql_lock,MYF(0));
DBUG_VOID_RETURN;
}
@@ -193,7 +195,7 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock)
if (i != found)
{
thr_multi_unlock(lock,i-found);
- sql_lock->lock_count-=found;
+ sql_lock->lock_count= found;
}
/* Then to the same for the external locks */
@@ -212,7 +214,7 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock)
if (i != found)
{
VOID(unlock_external(thd,table,i-found));
- sql_lock->table_count-=found;
+ sql_lock->table_count=found;
}
DBUG_VOID_RETURN;
}
@@ -294,7 +296,7 @@ static int unlock_external(THD *thd, TABLE **table,uint count)
DBUG_ENTER("unlock_external");
error_code=0;
- for (; count-- ; table++)
+ do
{
if ((*table)->current_lock != F_UNLCK)
{
@@ -302,7 +304,8 @@ static int unlock_external(THD *thd, TABLE **table,uint count)
if ((error=(*table)->file->external_lock(thd, F_UNLCK)))
error_code=error;
}
- }
+ table++;
+ } while (--count);
if (error_code)
print_lock_error(error_code);
DBUG_RETURN(error_code);