summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorHe Zhenxing <zhenxing.he@sun.com>2009-10-03 18:50:25 +0800
committerHe Zhenxing <zhenxing.he@sun.com>2009-10-03 18:50:25 +0800
commitf108d05932d6d565d98c18e5e01b9593f5ace684 (patch)
tree725dde87ce3a26584ba62f57b48424b2e0dd1a08 /sql/sql_class.cc
parenta8c14d9e0e078ac1092a325de2f1b46c881adc4d (diff)
parentd8724a4538a61ea6f98fb770c951b89bde734f77 (diff)
downloadmariadb-git-f108d05932d6d565d98c18e5e01b9593f5ace684.tar.gz
Manual merge semi-sync to 5.1-rep+2
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 6c2133ae6c8..f4e2e361184 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -278,6 +278,42 @@ const char *set_thd_proc_info(THD *thd, const char *info,
}
extern "C"
+const char* thd_enter_cond(MYSQL_THD thd, pthread_cond_t *cond,
+ pthread_mutex_t *mutex, const char *msg)
+{
+ if (!thd)
+ thd= current_thd;
+
+ const char* old_msg = thd->proc_info;
+ safe_mutex_assert_owner(mutex);
+ thd->mysys_var->current_mutex = mutex;
+ thd->mysys_var->current_cond = cond;
+ thd->proc_info = msg;
+ return old_msg;
+}
+
+extern "C"
+void thd_exit_cond(MYSQL_THD thd, const char *old_msg)
+{
+ if (!thd)
+ thd= current_thd;
+
+ /*
+ Putting the mutex unlock in thd_exit_cond() ensures that
+ mysys_var->current_mutex is always unlocked _before_ mysys_var->mutex is
+ locked (if that would not be the case, you'll get a deadlock if someone
+ does a THD::awake() on you).
+ */
+ pthread_mutex_unlock(thd->mysys_var->current_mutex);
+ pthread_mutex_lock(&thd->mysys_var->mutex);
+ thd->mysys_var->current_mutex = 0;
+ thd->mysys_var->current_cond = 0;
+ thd->proc_info = old_msg;
+ pthread_mutex_unlock(&thd->mysys_var->mutex);
+ return;
+}
+
+extern "C"
void **thd_ha_data(const THD *thd, const struct handlerton *hton)
{
return (void **) &thd->ha_data[hton->slot].ha_ptr;