#define TH_FL_SLEEPING 0x00000008 /* thread won't check its task list before next wakeup */
#define TH_FL_STARTED 0x00000010 /* set once the thread starts */
#define TH_FL_IN_LOOP 0x00000020 /* set only inside the polling loop */
-#define TH_FL_DUMPING_OTHERS 0x00000040 /* thread currently dumping other threads */
+/* unused 0x00000040 */
#define TH_FL_IN_SIG_HANDLER 0x00000080 /* thread currently in the generic signal handler */
#define TH_FL_IN_DBG_HANDLER 0x00000100 /* thread currently in the debug signal handler */
#define TH_FL_IN_WDT_HANDLER 0x00000200 /* thread currently in the wdt signal handler */
/* silence bogus warning in gcc 11 without threads */
ASSUME(0 <= thr && thr < MAX_THREADS);
- /* A thread that's currently dumping other threads cannot be dumped, or
- * it will very likely cause a deadlock.
- */
- if (HA_ATOMIC_LOAD(&ha_thread_ctx[thr].flags) & TH_FL_DUMPING_OTHERS)
- return NULL;
-
- /* This will be undone in ha_thread_dump_done(). We're using an atomic
- * OR to also block any possible re-entrance.
- */
- if (HA_ATOMIC_FETCH_OR(&th_ctx->flags, TH_FL_DUMPING_OTHERS) & TH_FL_DUMPING_OTHERS)
- return NULL;
-
if (thr != tid) {
struct buffer *old = NULL;
buf = HA_ATOMIC_LOAD(&ha_thread_ctx[thr].thread_dump_buffer);
if ((ulong)buf & 0x1)
break;
- if (!buf) {
- /* cancelled: no longer dumping */
- HA_ATOMIC_AND(&th_ctx->flags, ~TH_FL_DUMPING_OTHERS);
+ if (!buf)
return buf;
- }
ha_thread_relax();
}
}
continue;
}
} while (!HA_ATOMIC_CAS(&ha_thread_ctx[thr].thread_dump_buffer, &old, NULL));
-
- HA_ATOMIC_AND(&th_ctx->flags, ~TH_FL_DUMPING_OTHERS);
}
/* dumps into the buffer some information related to task <task> (which may
/* Process a few tasks */
process_runnable_tasks();
- /* If this happens this is an accidental leak */
- BUG_ON(HA_ATOMIC_LOAD(&th_ctx->flags) & TH_FL_DUMPING_OTHERS);
-
/* also stop if we failed to cleanly stop all tasks */
if (killed > 1)
break;
if (!p)
goto update_and_leave;
- if ((_HA_ATOMIC_LOAD(&ha_thread_ctx[thr].flags) & (TH_FL_SLEEPING|TH_FL_DUMPING_OTHERS)) ||
+ if ((_HA_ATOMIC_LOAD(&ha_thread_ctx[thr].flags) & TH_FL_SLEEPING) ||
(_HA_ATOMIC_LOAD(&ha_tgroup_ctx[tgrp-1].threads_harmless) & thr_bit)) {
/* This thread is currently doing exactly nothing
* waiting in the poll loop (unlikely but possible),
* waiting for all other threads to join the rendez-vous
* point (common), or waiting for another thread to
- * finish an isolated operation (unlikely but possible),
- * or waiting for another thread to finish dumping its
- * stack.
+ * finish an isolated operation (unlikely but possible).
*/
goto update_and_leave;
}