void statusReportThreadMain() { try { while (!this_thread::interruption_requested()) { struct stat buf; int ret; do { ret = stat(statusReportFIFO.c_str(), &buf); } while (ret == -1 && errno == EINTR); if (ret == -1 || !S_ISFIFO(buf.st_mode)) { // Something bad happened with the status report // FIFO, so we bail out. break; } FILE *f = InterruptableCalls::fopen(statusReportFIFO.c_str(), "w"); if (f == NULL) { break; } string report(pool.toString()); fwrite(report.c_str(), 1, report.size(), f); InterruptableCalls::fclose(f); // Prevent sending too much data at once. sleep(1); } } catch (const boost::thread_interrupted &) { P_TRACE(2, "Status report thread interrupted."); } }
void statusReportThreadMain() { TRACE_POINT(); try { while (!this_thread::interruption_requested()) { struct stat buf; int ret; UPDATE_TRACE_POINT(); do { ret = stat(statusReportFIFO.c_str(), &buf); } while (ret == -1 && errno == EINTR); if (ret == -1 || !S_ISFIFO(buf.st_mode)) { // Something bad happened with the status report // FIFO, so we bail out. break; } UPDATE_TRACE_POINT(); FILE *f = syscalls::fopen(statusReportFIFO.c_str(), "w"); if (f == NULL) { break; } UPDATE_TRACE_POINT(); string report(pool.toString()); report.append("\n\n"); report.append("----------- Backtraces -----------\n"); report.append(oxt::thread::all_backtraces()); fwrite(report.c_str(), 1, report.size(), f); syscalls::fclose(f); // Prevent sending too much data at once. UPDATE_TRACE_POINT(); sleep(1); } } catch (const boost::thread_interrupted &) { P_TRACE(2, "Status report thread interrupted."); } }