summaryrefslogtreecommitdiff
path: root/mysys/thr_lock.c
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@montyprogram.com>2012-01-10 16:58:30 +0100
committerVladislav Vaintroub <wlad@montyprogram.com>2012-01-10 16:58:30 +0100
commit67cfb8a5c564b2f1fb54e799bf331907f106ea4d (patch)
treeaf77b24bead4d39370f6f99c441d112d2e034ef6 /mysys/thr_lock.c
parentb2bbd30dee8d9e87f2b59d6522c6520464e7035f (diff)
downloadmariadb-git-67cfb8a5c564b2f1fb54e799bf331907f106ea4d.tar.gz
MDEV-82 : Fix place in thr_lock.c where wait-end callback was called without corresponding wait-begin
Diffstat (limited to 'mysys/thr_lock.c')
-rw-r--r--mysys/thr_lock.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c
index 61f18d9dddf..7387e35b062 100644
--- a/mysys/thr_lock.c
+++ b/mysys/thr_lock.c
@@ -482,6 +482,7 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
struct timespec wait_timeout;
enum enum_thr_lock_result result= THR_LOCK_ABORTED;
const char *old_proc_info;
+ my_bool use_wait_callbacks;
DBUG_ENTER("wait_for_lock");
/*
@@ -534,7 +535,12 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
and once after the thread has exited the wait loop.
*/
if ((!thread_var->abort || in_wait_list) && before_lock_wait)
+ {
+ use_wait_callbacks= TRUE;
(*before_lock_wait)();
+ }
+ else
+ use_wait_callbacks= FALSE;
set_timespec(wait_timeout, lock_wait_timeout);
while (!thread_var->abort || in_wait_list)
@@ -572,7 +578,7 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
We call the after_lock_wait callback once the wait loop has
finished.
*/
- if (after_lock_wait)
+ if (after_lock_wait && use_wait_callbacks)
(*after_lock_wait)();
DBUG_PRINT("thr_lock", ("aborted: %d in_wait_list: %d",