summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authormonty@mysql.com <>2005-07-27 13:24:59 +0300
committermonty@mysql.com <>2005-07-27 13:24:59 +0300
commit24d45c5c305b0137caa50ff9b58da195c6f02f90 (patch)
tree7f3dd2c80370d2c811475198141e5ab89b19adb0 /sql/sql_base.cc
parent3f6023c76e231a7126eef76b97075056348a55bf (diff)
parent4098c40d87ac11fe5043061f16a95a455376a782 (diff)
downloadmariadb-git-24d45c5c305b0137caa50ff9b58da195c6f02f90.tar.gz
Merge mysql.com:/home/my/mysql-4.0
into mysql.com:/home/my/mysql-4.1
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 720ce733ee1..ed09af5e070 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -2927,6 +2927,9 @@ void flush_tables()
The table will be closed (not stored in cache) by the current thread when
close_thread_tables() is called.
+ PREREQUISITES
+ Lock on LOCK_open()
+
RETURN
0 This thread now have exclusive access to this table and no other thread
can access the table until close_thread_tables() is called.
@@ -2942,6 +2945,7 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
bool result=0, signalled= 0;
DBUG_ENTER("remove_table_from_cache");
+
key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1;
for (;;)
{
@@ -2999,15 +3003,12 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
{
if (!(flags & RTFC_CHECK_KILLED_FLAG) || !thd->killed)
{
+ dropping_tables++;
if (likely(signalled))
- {
- dropping_tables++;
(void) pthread_cond_wait(&COND_refresh, &LOCK_open);
- dropping_tables--;
- continue;
- }
else
{
+ struct timespec abstime;
/*
It can happen that another thread has opened the
table but has not yet locked any table at all. Since
@@ -3018,11 +3019,11 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
and then we retry another loop in the
remove_table_from_cache routine.
*/
- pthread_mutex_unlock(&LOCK_open);
- my_sleep(10);
- pthread_mutex_lock(&LOCK_open);
- continue;
+ set_timespec(abstime, 10);
+ pthread_cond_timedwait(&COND_refresh, &LOCK_open, &abstime);
}
+ dropping_tables--;
+ continue;
}
}
break;