Commit da342880 authored by Eugene Kosov's avatar Eugene Kosov

cleanup: os_thread_yield() -> std::this_thread::yield()

parent 62e4aaa2
...@@ -2171,7 +2171,7 @@ btr_search_hash_table_validate(ulint hash_table_id) ...@@ -2171,7 +2171,7 @@ btr_search_hash_table_validate(ulint hash_table_id)
mysql_mutex_unlock(&buf_pool.mutex); mysql_mutex_unlock(&buf_pool.mutex);
btr_search_x_unlock_all(); btr_search_x_unlock_all();
os_thread_yield(); std::this_thread::yield();
btr_search_x_lock_all(); btr_search_x_lock_all();
...@@ -2279,7 +2279,7 @@ btr_search_hash_table_validate(ulint hash_table_id) ...@@ -2279,7 +2279,7 @@ btr_search_hash_table_validate(ulint hash_table_id)
mysql_mutex_unlock(&buf_pool.mutex); mysql_mutex_unlock(&buf_pool.mutex);
btr_search_x_unlock_all(); btr_search_x_unlock_all();
os_thread_yield(); std::this_thread::yield();
btr_search_x_lock_all(); btr_search_x_lock_all();
......
...@@ -288,7 +288,7 @@ void page_hash_latch::read_lock_wait() ...@@ -288,7 +288,7 @@ void page_hash_latch::read_lock_wait()
} }
/* Fall back to yielding to other threads. */ /* Fall back to yielding to other threads. */
do do
os_thread_yield(); std::this_thread::yield();
while (!read_trylock()); while (!read_trylock());
} }
...@@ -306,7 +306,7 @@ void page_hash_latch::write_lock_wait() ...@@ -306,7 +306,7 @@ void page_hash_latch::write_lock_wait()
/* Fall back to yielding to other threads. */ /* Fall back to yielding to other threads. */
do do
os_thread_yield(); std::this_thread::yield();
while (!write_lock_poll()); while (!write_lock_poll());
} }
......
...@@ -260,7 +260,7 @@ void buf_flush_remove_pages(ulint id) ...@@ -260,7 +260,7 @@ void buf_flush_remove_pages(ulint id)
break; break;
mysql_mutex_unlock(&buf_pool.mutex); mysql_mutex_unlock(&buf_pool.mutex);
os_thread_yield(); std::this_thread::yield();
mysql_mutex_lock(&buf_pool.mutex); mysql_mutex_lock(&buf_pool.mutex);
buf_flush_wait_batch_end(false); buf_flush_wait_batch_end(false);
} }
......
...@@ -60,7 +60,6 @@ extern "C" { typedef void* (*os_thread_func_t)(void*); } ...@@ -60,7 +60,6 @@ extern "C" { typedef void* (*os_thread_func_t)(void*); }
typedef void* (*os_posix_f_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_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()) #define os_thread_get_curr_id() IF_WIN(GetCurrentThreadId(), pthread_self())
/****************************************************************//** /****************************************************************//**
......
...@@ -919,7 +919,7 @@ void fts_parallel_tokenization( ...@@ -919,7 +919,7 @@ void fts_parallel_tokenization(
} }
if (doc_item == NULL) { if (doc_item == NULL) {
os_thread_yield(); std::this_thread::yield();
} }
row_merge_fts_get_next_doc_item(psort_info, &doc_item); row_merge_fts_get_next_doc_item(psort_info, &doc_item);
......
...@@ -1994,7 +1994,7 @@ row_merge_read_clustered_index( ...@@ -1994,7 +1994,7 @@ row_merge_read_clustered_index(
mtr_started = false; mtr_started = false;
/* Give the waiters a chance to proceed. */ /* Give the waiters a chance to proceed. */
os_thread_yield(); std::this_thread::yield();
scan_next: scan_next:
ut_ad(!mtr_started); ut_ad(!mtr_started);
ut_ad(!mtr.is_active()); ut_ad(!mtr.is_active());
......
...@@ -4205,7 +4205,7 @@ row_rename_table_for_mysql( ...@@ -4205,7 +4205,7 @@ row_rename_table_for_mysql(
for (retry = 0; retry < 100 for (retry = 0; retry < 100
&& table->n_foreign_key_checks_running > 0; ++retry) { && table->n_foreign_key_checks_running > 0; ++retry) {
row_mysql_unlock_data_dictionary(trx); row_mysql_unlock_data_dictionary(trx);
os_thread_yield(); std::this_thread::yield();
row_mysql_lock_data_dictionary(trx); row_mysql_lock_data_dictionary(trx);
} }
......
...@@ -1927,7 +1927,7 @@ void srv_shutdown_bg_undo_sources() ...@@ -1927,7 +1927,7 @@ void srv_shutdown_bg_undo_sources()
dict_stats_shutdown(); dict_stats_shutdown();
while (row_get_background_drop_list_len_low()) { while (row_get_background_drop_list_len_low()) {
srv_inc_activity_count(); srv_inc_activity_count();
os_thread_yield(); std::this_thread::yield();
} }
srv_undo_sources = false; srv_undo_sources = false;
} }
......
...@@ -967,7 +967,7 @@ trx_purge_choose_next_log(void) ...@@ -967,7 +967,7 @@ trx_purge_choose_next_log(void)
trx_purge_read_undo_rec(); trx_purge_read_undo_rec();
} else { } else {
/* There is nothing to do yet. */ /* There is nothing to do yet. */
os_thread_yield(); std::this_thread::yield();
} }
} }
......
...@@ -1378,7 +1378,7 @@ inline void trx_t::commit_in_memory(const mtr_t *mtr) ...@@ -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 /* 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! */ to commit! */
/*-------------------------------------*/ /*-------------------------------------*/
......
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