MCPcopy Create free account
hub / github.com/MariaDB/server / try_suspend

Method try_suspend

sql/sql_class.h:3186–3208  ·  view source on GitHub ↗

Currently only used with threadpool, one can "suspend" and "resume" a THD. Suspend only means leaving do_command earlier, after saving some state. Resume is continuing suspended THD's do_command(), from where it finished last time. */

Source from the content-addressed store, hash-verified

3184 Resume is continuing suspended THD's do_command(), from where it finished last time.
3185 */
3186 bool try_suspend()
3187 {
3188 bool ret;
3189 mysql_mutex_lock(&m_mtx);
3190 DBUG_ASSERT(m_state == enum_async_state::NONE);
3191 DBUG_ASSERT(m_pending_ops >= 0);
3192
3193 if(m_pending_ops)
3194 {
3195 ret=true;
3196 m_state= enum_async_state::SUSPENDED;
3197 }
3198 else
3199 {
3200 /*
3201 If there is no pending operations, can't suspend, since
3202 nobody can resume it.
3203 */
3204 ret=false;
3205 }
3206 mysql_mutex_unlock(&m_mtx);
3207 return ret;
3208 }
3209
3210 ~thd_async_state()
3211 {

Callers 1

tp_callbackFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected