diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2012-07-05 22:04:13 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2012-07-05 22:04:13 +0400 |
commit | 3e90dc1f77dc3fa51d542bf82a336753310f7776 (patch) | |
tree | d0c14418aa1ab3d3af27a98cd9a27d603d753fac /unittest | |
parent | b97678f066dd9dfb32409c61028080ac14efb1eb (diff) | |
download | mariadb-git-3e90dc1f77dc3fa51d542bf82a336753310f7776.tar.gz |
MWL#182: Explain running statements
- Make SHOW EXPLAIN command be KILLable with KILL QUERY.
Diffstat (limited to 'unittest')
-rw-r--r-- | unittest/sql/my_apc-t.cc | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/unittest/sql/my_apc-t.cc b/unittest/sql/my_apc-t.cc index fccfb6ecd13..3b837b4700e 100644 --- a/unittest/sql/my_apc-t.cc +++ b/unittest/sql/my_apc-t.cc @@ -24,6 +24,29 @@ #include <tap.h> +/* + A fake THD with enter_cond/exit_cond and some other members. +*/ +class THD +{ + mysql_mutex_t* thd_mutex; +public: + bool killed; + + THD() : killed(FALSE) {} + inline const char* enter_cond(mysql_cond_t *cond, mysql_mutex_t* mutex, + const char* msg) + { + mysql_mutex_assert_owner(mutex); + thd_mutex= mutex; + return NULL; + } + inline void exit_cond(const char* old_msg) + { + mysql_mutex_unlock(thd_mutex); + } +}; + #include "../sql/my_apc.h" #define MY_APC_STANDALONE 1 @@ -115,6 +138,8 @@ void *test_apc_requestor_thread(void *ptr) { my_thread_init(); fprintf(stderr, "# test_apc_requestor_thread started\n"); + THD my_thd; + while (!requestors_should_exit) { int dst_value= 0; @@ -124,7 +149,7 @@ void *test_apc_requestor_thread(void *ptr) bool timed_out; mysql_mutex_lock(&target_mutex); - bool res= apc_target.make_apc_call(&apc_order, 60, &timed_out); + bool res= apc_target.make_apc_call(&my_thd, &apc_order, 60, &timed_out); if (res) { if (timed_out) |