Skip to content

Commit

Permalink
cleanup: os_thread_yield() -> std::this_thread::yield()
Browse files Browse the repository at this point in the history
  • Loading branch information
kevgs committed Mar 19, 2021
1 parent 62e4aaa commit da34288
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions storage/innobase/btr/btr0sea.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2171,7 +2171,7 @@ btr_search_hash_table_validate(ulint hash_table_id)
mysql_mutex_unlock(&buf_pool.mutex);
btr_search_x_unlock_all();

os_thread_yield();
std::this_thread::yield();

btr_search_x_lock_all();

Expand Down Expand Up @@ -2279,7 +2279,7 @@ btr_search_hash_table_validate(ulint hash_table_id)
mysql_mutex_unlock(&buf_pool.mutex);
btr_search_x_unlock_all();

os_thread_yield();
std::this_thread::yield();

btr_search_x_lock_all();

Expand Down
4 changes: 2 additions & 2 deletions storage/innobase/buf/buf0buf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ void page_hash_latch::read_lock_wait()
}
/* Fall back to yielding to other threads. */
do
os_thread_yield();
std::this_thread::yield();
while (!read_trylock());
}

Expand All @@ -306,7 +306,7 @@ void page_hash_latch::write_lock_wait()

/* Fall back to yielding to other threads. */
do
os_thread_yield();
std::this_thread::yield();
while (!write_lock_poll());
}

Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/buf/buf0flu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ void buf_flush_remove_pages(ulint id)
break;

mysql_mutex_unlock(&buf_pool.mutex);
os_thread_yield();
std::this_thread::yield();
mysql_mutex_lock(&buf_pool.mutex);
buf_flush_wait_batch_end(false);
}
Expand Down
1 change: 0 additions & 1 deletion storage/innobase/include/os0thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ extern "C" { typedef void* (*os_thread_func_t)(void*); }
typedef void* (*os_posix_f_t) (void*);

#define os_thread_eq(a,b) IF_WIN(a == b, pthread_equal(a, b))
#define os_thread_yield() IF_WIN(SwitchToThread(), sched_yield())
#define os_thread_get_curr_id() IF_WIN(GetCurrentThreadId(), pthread_self())

/****************************************************************//**
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/row/row0ftsort.cc
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ void fts_parallel_tokenization(
}

if (doc_item == NULL) {
os_thread_yield();
std::this_thread::yield();
}

row_merge_fts_get_next_doc_item(psort_info, &doc_item);
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/row/row0merge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1994,7 +1994,7 @@ row_merge_read_clustered_index(
mtr_started = false;

/* Give the waiters a chance to proceed. */
os_thread_yield();
std::this_thread::yield();
scan_next:
ut_ad(!mtr_started);
ut_ad(!mtr.is_active());
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/row/row0mysql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4205,7 +4205,7 @@ row_rename_table_for_mysql(
for (retry = 0; retry < 100
&& table->n_foreign_key_checks_running > 0; ++retry) {
row_mysql_unlock_data_dictionary(trx);
os_thread_yield();
std::this_thread::yield();
row_mysql_lock_data_dictionary(trx);
}

Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/srv/srv0start.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1927,7 +1927,7 @@ void srv_shutdown_bg_undo_sources()
dict_stats_shutdown();
while (row_get_background_drop_list_len_low()) {
srv_inc_activity_count();
os_thread_yield();
std::this_thread::yield();
}
srv_undo_sources = false;
}
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/trx/trx0purge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ trx_purge_choose_next_log(void)
trx_purge_read_undo_rec();
} else {
/* There is nothing to do yet. */
os_thread_yield();
std::this_thread::yield();
}
}

Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/trx/trx0trx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,7 @@ inline void trx_t::commit_in_memory(const mtr_t *mtr)
}

/* NOTE that we could possibly make a group commit more efficient
here: call os_thread_yield here to allow also other trxs to come
here: call std::this_thread::yield() here to allow also other trxs to come
to commit! */

/*-------------------------------------*/
Expand Down

0 comments on commit da34288

Please sign in to comment.