| 55 | backtrace_symbols_fd(frames, n, 2); |
| 56 | } |
| 57 | void dump_thread_stacks(std::vector<std::thread>& threads) { |
| 58 | struct sigaction sa{}; |
| 59 | sa.sa_handler = stall_stack_handler; |
| 60 | sigemptyset(&sa.sa_mask); |
| 61 | if (sigaction(SIGUSR2, &sa, nullptr) != 0) return; |
| 62 | for (auto& t : threads) { |
| 63 | if (!t.joinable()) continue; |
| 64 | pthread_kill(t.native_handle(), SIGUSR2); |
| 65 | usleep(150000); // one thread at a time: the handlers' lines do not mix |
| 66 | } |
| 67 | } |
| 68 | #else |
| 69 | void dump_thread_stacks(std::vector<std::thread>&) {} |
| 70 | #endif |
no test coverage detected