summaryrefslogtreecommitdiff
path: root/sql/lock.cc
diff options
context:
space:
mode:
authorunknown <ingo@mysql.com>2006-07-04 10:02:11 +0200
committerunknown <ingo@mysql.com>2006-07-04 10:02:11 +0200
commit597ee0392c6457f22ac450609557cd117fe1f235 (patch)
tree0d83d5fae0e2ee575858f6cd66a909db278d2c56 /sql/lock.cc
parent2ef57b836248f945657c7bd0fe02fa7fe3660b54 (diff)
parent0f93a64effb53f2902698a9d6f020f89d0edd26a (diff)
downloadmariadb-git-597ee0392c6457f22ac450609557cd117fe1f235.tar.gz
Merge mysql.com:/home/mydev/mysql-5.0-tmp_merge
into mysql.com:/home/mydev/mysql-5.1-amerge mysys/thr_lock.c: Auto merged sql/mysql_priv.h: Auto merged sql/sql_handler.cc: Auto merged sql/sql_insert.cc: Auto merged mysql-test/r/lock_multi.result: Manual merge mysql-test/t/lock_multi.test: Manual merge sql/lock.cc: Manual merge sql/sql_base.cc: Manual merge sql/sql_parse.cc: Manual merge sql/sql_table.cc: Manual merge
Diffstat (limited to 'sql/lock.cc')
-rw-r--r--sql/lock.cc46
1 files changed, 41 insertions, 5 deletions
diff --git a/sql/lock.cc b/sql/lock.cc
index e5003325df6..8e75ea42f7d 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -935,7 +935,7 @@ void unlock_table_name(THD *thd, TABLE_LIST *table_list)
if (table_list->table)
{
hash_delete(&open_cache, (byte*) table_list->table);
- (void) pthread_cond_broadcast(&COND_refresh);
+ broadcast_refresh();
}
}
@@ -1037,9 +1037,9 @@ end:
(default 0, which will unlock all tables)
NOTES
- One must have a lock on LOCK_open when calling this
- This function will send a COND_refresh signal to inform other threads
- that the name locks are removed
+ One must have a lock on LOCK_open when calling this.
+ This function will broadcast refresh signals to inform other threads
+ that the name locks are removed.
RETURN
0 ok
@@ -1054,7 +1054,7 @@ void unlock_table_names(THD *thd, TABLE_LIST *table_list,
table != last_table;
table= table->next_local)
unlock_table_name(thd,table);
- pthread_cond_broadcast(&COND_refresh);
+ broadcast_refresh();
DBUG_VOID_RETURN;
}
@@ -1344,3 +1344,39 @@ bool make_global_read_lock_block_commit(THD *thd)
thd->exit_cond(old_message); // this unlocks LOCK_global_read_lock
DBUG_RETURN(error);
}
+
+
+/*
+ Broadcast COND_refresh and COND_global_read_lock.
+
+ SYNOPSIS
+ broadcast_refresh()
+ void No parameters.
+
+ DESCRIPTION
+ Due to a bug in a threading library it could happen that a signal
+ did not reach its target. A condition for this was that the same
+ condition variable was used with different mutexes in
+ pthread_cond_wait(). Some time ago we changed LOCK_open to
+ LOCK_global_read_lock in global read lock handling. So COND_refresh
+ was used with LOCK_open and LOCK_global_read_lock.
+
+ We did now also change from COND_refresh to COND_global_read_lock
+ in global read lock handling. But now it is necessary to signal
+ both conditions at the same time.
+
+ NOTE
+ When signalling COND_global_read_lock within the global read lock
+ handling, it is not necessary to also signal COND_refresh.
+
+ RETURN
+ void
+*/
+
+void broadcast_refresh(void)
+{
+ VOID(pthread_cond_broadcast(&COND_refresh));
+ VOID(pthread_cond_broadcast(&COND_global_read_lock));
+}
+
+