1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge mysql.com:/home/my/mysql-4.0

into  mysql.com:/home/my/mysql-4.1
This commit is contained in:
monty@mysql.com
2005-07-27 13:24:59 +03:00
7 changed files with 33 additions and 19 deletions

View File

@ -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;