summaryrefslogtreecommitdiff
path: root/mysys/waiting_threads.c
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mysql.com>2008-08-07 22:57:25 +0200
committerSergei Golubchik <serg@mysql.com>2008-08-07 22:57:25 +0200
commitf8c1059cbf62e95d2684fdf8b9badc398f845173 (patch)
tree7bc29e1219370afd3f03b8a9fdf4f2097ee0d106 /mysys/waiting_threads.c
parent5a4cdba54415faf7dd0b5afdb8ed683dea1c126b (diff)
downloadmariadb-git-f8c1059cbf62e95d2684fdf8b9badc398f845173.tar.gz
move wt* maintainance from maria to the server
include/waiting_threads.h: C_MODE_START/END mysys/waiting_threads.c: relax the checks - auto init thd in will_wait_for, allow to destroy uninited thd (=noop), allow a "release" an unexistent resource (=noop), sql/sql_class.cc: move wt* maintainance from maria to the server. do THD::cleanup after ha_close_connection() and plugin_thdvar_cleanup(). storage/maria/unittest/trnman-t.c: update to new prototype
Diffstat (limited to 'mysys/waiting_threads.c')
-rw-r--r--mysys/waiting_threads.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/mysys/waiting_threads.c b/mysys/waiting_threads.c
index 491e7c3a726..55f65be2811 100644
--- a/mysys/waiting_threads.c
+++ b/mysys/waiting_threads.c
@@ -208,6 +208,9 @@ void wt_thd_destroy(WT_THD *thd)
{
DBUG_ENTER("wt_thd_destroy");
+ if (thd->my_resources.buffer == 0)
+ DBUG_VOID_RETURN; /* nothing to do */
+
DBUG_ASSERT(thd->my_resources.elements == 0);
delete_dynamic(&thd->my_resources);
lf_hash_put_pins(thd->pins);
@@ -447,6 +450,9 @@ int wt_thd_will_wait_for(WT_THD *thd, WT_THD *blocker, WT_RESOURCE_ID *resid)
DBUG_PRINT("wt", ("enter: thd=%s, blocker=%s, resid=%llu",
thd->name, blocker->name, resid->value.num));
+ if (unlikely(thd->my_resources.buffer == 0))
+ wt_thd_init(thd);
+
if (thd->waiting_for == 0)
{
uint keylen;
@@ -647,8 +653,8 @@ void wt_thd_release(WT_THD *thd, WT_RESOURCE_ID *resid)
}
}
}
- DBUG_ASSERT(!resid);
- reset_dynamic(&thd->my_resources);
+ if (!resid)
+ reset_dynamic(&thd->my_resources);
DBUG_VOID_RETURN;
}