Commit 642077ea authored by Marko Mäkelä's avatar Marko Mäkelä

srv_get_active_thread_type(): Remove a potential race condition.

Call trx_purge_state() only once, to avoid a race condition if the
value changes while the conditions are being evaluated.
parent 7128328d
...@@ -2013,13 +2013,18 @@ srv_get_active_thread_type(void) ...@@ -2013,13 +2013,18 @@ srv_get_active_thread_type(void)
srv_sys_mutex_exit(); srv_sys_mutex_exit();
if (ret == SRV_NONE && srv_shutdown_state != SRV_SHUTDOWN_NONE) {
/* Check only on shutdown. */ /* Check only on shutdown. */
if (ret == SRV_NONE switch (trx_purge_state()) {
&& srv_shutdown_state != SRV_SHUTDOWN_NONE case PURGE_STATE_INIT:
&& trx_purge_state() != PURGE_STATE_DISABLED case PURGE_STATE_RUN:
&& trx_purge_state() != PURGE_STATE_EXIT) { case PURGE_STATE_STOP:
ret = SRV_PURGE; ret = SRV_PURGE;
break;
case PURGE_STATE_DISABLED:
case PURGE_STATE_EXIT:
break;
}
} }
return(ret); return(ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment