diff options
author | monty@narttu.mysql.fi <> | 2003-03-04 12:22:35 +0200 |
---|---|---|
committer | monty@narttu.mysql.fi <> | 2003-03-04 12:22:35 +0200 |
commit | 2a7dfa172c9edf84ce503fdde37e22a8227ef9dc (patch) | |
tree | 6c1fb5d875ec9be01b82dead74784385452e9aa2 /mysys/thr_lock.c | |
parent | 065bcf92fb8d193508602ed9ea0bf086b21038ce (diff) | |
download | mariadb-git-2a7dfa172c9edf84ce503fdde37e22a8227ef9dc.tar.gz |
Fixed bug in LOCK TABLE + DROP TABLE when other thread was waiting for a table that was locked bug not droped
Diffstat (limited to 'mysys/thr_lock.c')
-rw-r--r-- | mysys/thr_lock.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c index 0288c7c1cbe..61616a4cf2b 100644 --- a/mysys/thr_lock.c +++ b/mysys/thr_lock.c @@ -945,6 +945,54 @@ void thr_abort_locks(THR_LOCK *lock) } +/* + Abort all locks for specific table/thread combination + + This is used to abort all locks for a specific thread +*/ + +void thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread) +{ + THR_LOCK_DATA *data; + DBUG_ENTER("thr_abort_locks_for_thread"); + + pthread_mutex_lock(&lock->mutex); + for (data= lock->read_wait.data; data ; data= data->next) + { + if (pthread_equal(thread, data->thread)) + { + DBUG_PRINT("info",("Aborting read-wait lock")); + data->type= TL_UNLOCK; /* Mark killed */ + pthread_cond_signal(data->cond); + data->cond= 0; /* Removed from list */ + + if (((*data->prev)= data->next)) + data->next->prev= data->prev; + else + lock->read_wait.last= data->prev; + } + } + for (data= lock->write_wait.data; data ; data= data->next) + { + if (pthread_equal(thread, data->thread)) + { + DBUG_PRINT("info",("Aborting write-wait lock")); + data->type= TL_UNLOCK; + pthread_cond_signal(data->cond); + data->cond= 0; + + if (((*data->prev)= data->next)) + data->next->prev= data->prev; + else + lock->write_wait.last= data->prev; + } + } + pthread_mutex_unlock(&lock->mutex); + DBUG_VOID_RETURN; +} + + + /* Upgrade a WRITE_DELAY lock to a WRITE_LOCK */ my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data) |