From c029e5c39d0cbbc16a2519ff1584c1b9aac61836 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Thu, 13 Oct 2022 11:21:40 +0200 Subject: [PATCH] Added macro for debug builds --- src/common.h | 8 ++++++++ src/side_chain.cpp | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/common.h b/src/common.h index fcbe3cd..aaf0bc3 100644 --- a/src/common.h +++ b/src/common.h @@ -81,6 +81,14 @@ #endif +#ifndef __has_feature + #define __has_feature(x) 0 +#endif + +#if defined(_DEBUG) || defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer) || defined(__SANITIZE_THREAD__) || __has_feature(thread_sanitizer) +#define P2POOL_DEBUGGING 1 +#endif + namespace p2pool { constexpr size_t HASH_SIZE = 32; diff --git a/src/side_chain.cpp b/src/side_chain.cpp index fa013f0..97dba75 100644 --- a/src/side_chain.cpp +++ b/src/side_chain.cpp @@ -171,7 +171,8 @@ SideChain::SideChain(p2pool* pool, NetworkType type, const char* pool_name) // Use between 1 and 8 threads if (numThreads < 1) numThreads = 1; -#ifndef _DEBUG + // Don't limit thread count when debugging because debug builds are slow +#ifndef P2POOL_DEBUGGING if (numThreads > 8) numThreads = 8; #endif