title: How to run gprof on non-terminating multi-threaded C++ program?
body: <p>I can't call <code>std::exit</code> from an arbitrary thread (or via a signal handler), because other still-running threads will experience undefined behavior (typically, a segfault).</p>
  <p>Normally, to exit the program, I would use <code>std::quick_exit</code>, but that doesn't produce the <code>gmon.out</code> file.</p>
  <p>So is there a way to produce the <code>gmon.out</code> file?</p>