I want to profile my daemon program, that pauses the main thread:
sigset_t signal_mask;
sigemptyset(&signal_mask);
sigaddset(&signal_mask, SIGTERM);
sigaddset(&signal_mask, SIGINT);
int sig;
sigwait(&signal_mask, &sig);
All other threads simply block all signals.
As far as I know the profiler uses SIGPROF
signal for its operations. If I start profiling with such a code, the output .prof file is empty:
env CPUPROFILE=daemon.prof ./daemon
How should I properly handle signals in main thread and other threads to enable profiling? Or may be an issue is somewhere else?