From 747ab513631e6635d503cfb0a98ae32ad72cddbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sun, 14 Jan 2024 18:05:11 +0100 Subject: [PATCH] Revert BaseTime reduction as GH runners can receive low CPU --- test/get_process_id_name.hpp | 9 +++------ test/sharable_mutex_test_template.hpp | 8 ++++---- test/util.hpp | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/test/get_process_id_name.hpp b/test/get_process_id_name.hpp index 0ebcd09..c2d9733 100644 --- a/test/get_process_id_name.hpp +++ b/test/get_process_id_name.hpp @@ -24,16 +24,14 @@ namespace test{ inline void get_process_id_name(std::string &str) { std::stringstream sstr; - sstr << "process_" << boost::interprocess::ipcdetail::get_current_process_id() << "_rand_" - << boost::interprocess::ipcdetail::get_system_tick_in_highres_counts() << std::ends; + sstr << "process_" << boost::interprocess::ipcdetail::get_current_process_id() << std::ends; str = sstr.str().c_str(); } inline void get_process_id_ptr_name(std::string &str, const void *ptr) { std::stringstream sstr; - sstr << "process_" << boost::interprocess::ipcdetail::get_current_process_id() << "_" << ptr << "_rand_" - << boost::interprocess::ipcdetail::get_system_tick_in_highres_counts() << std::ends; + sstr << "process_" << boost::interprocess::ipcdetail::get_current_process_id() << "_" << ptr << std::ends; str = sstr.str().c_str(); } @@ -94,8 +92,7 @@ namespace test { inline void get_process_id_wname(std::wstring &str) { std::wstringstream sstr; - sstr << L"process_" << boost::interprocess::ipcdetail::get_current_process_id() << "_rand_" - << boost::interprocess::ipcdetail::get_system_tick_in_highres_counts() << std::ends; + sstr << L"process_" << boost::interprocess::ipcdetail::get_current_process_id() << std::ends; str = sstr.str().c_str(); } diff --git a/test/sharable_mutex_test_template.hpp b/test/sharable_mutex_test_template.hpp index 5249eac..52a2f05 100644 --- a/test/sharable_mutex_test_template.hpp +++ b/test/sharable_mutex_test_template.hpp @@ -96,14 +96,14 @@ void test_plain_sharable_mutex() boost::interprocess::ipcdetail::thread_launch(tw1, thread_adapter(plain_exclusive, &e1, mtx)); //Give time to e1 to grab the mutex - boost::interprocess::ipcdetail::thread_sleep_ms(unsigned(1*BaseMs/2)); + boost::interprocess::ipcdetail::thread_sleep_ms(unsigned(1*BaseMs)); // Writer two launches, tries to grab the lock, "clearly" // after Writer one will already be holding it. boost::interprocess::ipcdetail::OS_thread_t tw2; boost::interprocess::ipcdetail::thread_launch(tw2, thread_adapter(plain_exclusive, &e2, mtx)); - boost::interprocess::ipcdetail::thread_sleep_ms(unsigned(1*BaseMs/2)); + boost::interprocess::ipcdetail::thread_sleep_ms(unsigned(1*BaseMs)); // Readers launche, "clearly" after writer two, and "clearly" // while writer 1 still holds the lock @@ -139,7 +139,7 @@ void test_plain_sharable_mutex() boost::interprocess::ipcdetail::thread_launch(thr2, thread_adapter(plain_shared,&s2, mtx)); //Make sure they try to hold the sharable lock - boost::interprocess::ipcdetail::thread_sleep_ms(unsigned(1*BaseMs/2u)); + boost::interprocess::ipcdetail::thread_sleep_ms(unsigned(1*BaseMs)); // We launch two writers, that should block until the readers end boost::interprocess::ipcdetail::OS_thread_t tw1; @@ -177,7 +177,7 @@ void test_try_sharable_mutex() boost::interprocess::ipcdetail::OS_thread_t tw1; boost::interprocess::ipcdetail::thread_launch(tw1, thread_adapter(try_exclusive,&e1,mtx)); - boost::interprocess::ipcdetail::thread_sleep_ms(unsigned(1*BaseMs/2u)); + boost::interprocess::ipcdetail::thread_sleep_ms(unsigned(1*BaseMs)); // Reader one launches, "clearly" after writer #1 holds the lock // and before it releases the lock. diff --git a/test/util.hpp b/test/util.hpp index 0ad48a4..68b1b4e 100644 --- a/test/util.hpp +++ b/test/util.hpp @@ -143,7 +143,7 @@ struct data }; int shared_val = 0; -static const unsigned BaseMs = 300; +static const unsigned BaseMs = 1000; } //namespace test { } //namespace interprocess {