diff --git a/sql/handler.cc b/sql/handler.cc index 5c13940e5c10..9dc7cc47a846 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2912,7 +2912,7 @@ void handler::ha_statistic_increment( (table->in_use->status_var.*offset)++; table->in_use->check_limit_rows_examined(); table->in_use->update_sql_stats_periodic(); - table->in_use->check_yield(std::bind(yield_condition, table)); + table->in_use->check_yield([t = table] { return yield_condition(t); }); } } @@ -6502,7 +6502,7 @@ ha_rows handler::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, while (!seq->next(seq_it, &range)) { if (unlikely(thd->killed != 0)) return HA_POS_ERROR; - thd->check_yield(std::bind(yield_condition, table)); + thd->check_yield([t = table] { return yield_condition(t); }); n_ranges++; key_range *min_endp, *max_endp; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index db1946f8829d..6f07e83542f2 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -2733,7 +2733,7 @@ void THD::restore_sub_statement_state(Sub_statement_state *backup) { } void THD::check_yield(std::function cond) { - yield_cond = cond; + yield_cond = std::move(cond); thd_wait_begin(this, THD_WAIT_YIELD); thd_wait_end(this); yield_cond = nullptr;