summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2016-08-03 12:41:38 +0000
committerVladislav Vaintroub <wlad@mariadb.com>2016-08-03 12:41:38 +0000
commit141f88d1d5bd61ed736d200a9dd9d5c8d1a437ab (patch)
tree77fe9ce31efc2c91768b35b4f530eedd5406845c /mysys
parentecb7ce7844237e2366ab5e8d9963f370cb1042aa (diff)
downloadmariadb-git-141f88d1d5bd61ed736d200a9dd9d5c8d1a437ab.tar.gz
MDEV-10357 my_context_continue() does not store current fiber on Windows
Make sure current fiber is saved in my_context::app_fiber in both my_context_spawn() and my_context_continue()
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_context.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/mysys/my_context.c b/mysys/my_context.c
index 01d6f404627..5ddb2ccd566 100644
--- a/mysys/my_context.c
+++ b/mysys/my_context.c
@@ -698,30 +698,27 @@ my_context_destroy(struct my_context *c)
int
my_context_spawn(struct my_context *c, void (*f)(void *), void *d)
{
- void *current_fiber;
c->user_func= f;
c->user_arg= d;
+ return my_context_continue(c);
+}
+
+int
+my_context_continue(struct my_context *c)
+{
/*
This seems to be a common trick to run ConvertThreadToFiber() only on the
first occurence in a thread, in a way that works on multiple Windows
versions.
*/
- current_fiber= GetCurrentFiber();
+ void *current_fiber= GetCurrentFiber();
if (current_fiber == NULL || current_fiber == (void *)0x1e00)
current_fiber= ConvertThreadToFiber(c);
c->app_fiber= current_fiber;
DBUG_SWAP_CODE_STATE(&c->dbug_state);
SwitchToFiber(c->lib_fiber);
DBUG_SWAP_CODE_STATE(&c->dbug_state);
- return c->return_value;
-}
-int
-my_context_continue(struct my_context *c)
-{
- DBUG_SWAP_CODE_STATE(&c->dbug_state);
- SwitchToFiber(c->lib_fiber);
- DBUG_SWAP_CODE_STATE(&c->dbug_state);
return c->return_value;
}