BUILD: debug: do not check the isolated_thread variable in non-threaded builds

The build without thread support was broken by commit b30ced3d8 ("BUG/MINOR:
debug: fix incorrect profiling status reporting in show threads") because
it accesses the isolated_thread variable that is not defined when threads
are disabled. In fact both the test on harmless and this one make no sense
without threads, so let's comment out the block and mark the related
variables as unused.

This may have to be backported to 2.7 if the commit above is.
This commit is contained in:
Willy Tarreau 2023-05-07 15:02:30 +02:00
parent d8cbfa5ad5
commit 95e6c9999a

View File

@ -183,11 +183,11 @@ void ha_backtrace_to_stderr(void)
void ha_thread_dump_one(int thr, int from_signal)
{
struct buffer *buf = HA_ATOMIC_LOAD(&ha_thread_ctx[thr].thread_dump_buffer);
unsigned long thr_bit = ha_thread_info[thr].ltid_bit;
unsigned long __maybe_unused thr_bit = ha_thread_info[thr].ltid_bit;
int __maybe_unused tgrp = ha_thread_info[thr].tgid;
unsigned long long p = ha_thread_ctx[thr].prev_cpu_time;
unsigned long long n = now_cpu_time_thread(thr);
int stuck = !!(ha_thread_ctx[thr].flags & TH_FL_STUCK);
int tgrp = ha_thread_info[thr].tgid;
chunk_appendf(buf,
"%c%cThread %-2u: id=0x%llx act=%d glob=%d wq=%d rq=%d tl=%d tlsz=%d rqsz=%d\n"
@ -208,10 +208,12 @@ void ha_thread_dump_one(int thr, int from_signal)
stuck,
!!(ha_thread_ctx[thr].flags & TH_FL_TASK_PROFILING));
#if defined(USE_THREAD)
chunk_appendf(buf,
" harmless=%d isolated=%d",
!!(_HA_ATOMIC_LOAD(&ha_tgroup_ctx[tgrp-1].threads_harmless) & thr_bit),
isolated_thread == thr);
#endif
chunk_appendf(buf, "\n");
chunk_appendf(buf, " cpu_ns: poll=%llu now=%llu diff=%llu\n", p, n, n-p);