29 #ifndef TOMOGRAPHER_TOOLS_SIGNAL_STATUS_REPORT 30 #define TOMOGRAPHER_TOOLS_SIGNAL_STATUS_REPORT 52 template<
typename TaskDispatcher,
typename Logger>
56 typedef typename TaskDispatcher::FullStatusReportType FullStatusReportType;
59 : tasks(tasks_), logger(logger_)
61 logger.debug(
"Tomographer::Tools::SigHandlerTaskDispatcherStatusReporter",
62 "Setting up signal handler, with default callback") ;
63 tasks->setStatusReportHandler(intermediateProgressReport) ;
66 template<
typename CallbackFn>
68 : tasks(tasks_), logger(logger_)
70 logger.debug(
"Tomographer::Tools::SigHandlerTaskDispatcherStatusReporter",
71 "Setting up signal handler, with custom callback") ;
72 tasks->setStatusReportHandler(std::forward<CallbackFn>(fn)) ;
75 TaskDispatcher * tasks;
78 virtual void handleSignal(
int )
86 tasks->requestStatusReport();
94 std::cerr <<
"\n" << report.getHumanReport() <<
"\n";
99 template<
typename TaskDispatcher,
typename LoggerT>
101 makeSigHandlerTaskDispatcherStatusReporter(TaskDispatcher * tasks, LoggerT & logger)
107 template<
typename TaskDispatcher,
typename LoggerT,
typename CallbackFn>
109 makeSigHandlerTaskDispatcherStatusReporter(TaskDispatcher * tasks, LoggerT & logger, CallbackFn && fn)
114 std::forward<CallbackFn>(fn)
Base namespace for the Tomographer project.
Some common definitions for multiprocessing interfaces.
Basic common code for intercepting a signal and basic interfacing to C++.