Fixed msys2 build crash

pull/71/head
SChernykh 3 years ago
parent b56d027dd5
commit 998c2ba72f

@ -54,7 +54,7 @@ public:
: m_writePos(0) : m_writePos(0)
, m_readPos(0) , m_readPos(0)
{ {
is_main_thread = true; set_main_thread();
m_logFile.open(log_file_name, std::ios::app | std::ios::binary); m_logFile.open(log_file_name, std::ios::app | std::ios::binary);

@ -226,7 +226,7 @@ void p2pool::handle_miner_data(MinerData& data)
"\n---------------------------------------------------------------------------------------------------------------" "\n---------------------------------------------------------------------------------------------------------------"
); );
if (!is_main_thread) { if (!is_main_thread()) {
update_block_template_async(); update_block_template_async();
} }
else { else {

@ -225,7 +225,7 @@ void uv_rwlock_init_checked(uv_rwlock_t* lock)
uv_loop_t* uv_default_loop_checked() uv_loop_t* uv_default_loop_checked()
{ {
if (!is_main_thread) { if (!is_main_thread()) {
LOGERR(1, "uv_default_loop() can only be used by the main thread. Fix the code!"); LOGERR(1, "uv_default_loop() can only be used by the main thread. Fix the code!");
#ifdef _WIN32 #ifdef _WIN32
if (IsDebuggerPresent()) { if (IsDebuggerPresent()) {
@ -339,7 +339,10 @@ void BackgroundJobTracker::print_status()
} }
BackgroundJobTracker bkg_jobs_tracker; BackgroundJobTracker bkg_jobs_tracker;
thread_local bool is_main_thread = false;
static thread_local bool main_thread = false;
void set_main_thread() { main_thread = true; }
bool is_main_thread() { return main_thread; }
bool resolve_host(std::string& host, bool& is_v6) bool resolve_host(std::string& host, bool& is_v6)
{ {

@ -133,7 +133,9 @@ private:
}; };
extern BackgroundJobTracker bkg_jobs_tracker; extern BackgroundJobTracker bkg_jobs_tracker;
extern thread_local bool is_main_thread;
void set_main_thread();
bool is_main_thread();
bool resolve_host(std::string& host, bool& is_v6); bool resolve_host(std::string& host, bool& is_v6);

Loading…
Cancel
Save