JANA2
JSignalHandler Namespace Reference

JSignalHandler bundles together the logic for querying a JApplication about its JStatus with signal handlers for USR1, USR2, and CTRL-C. More...

Functions

void create_named_pipe (const std::string &path_to_named_pipe)
 
void send_to_named_pipe (const std::string &path_to_named_pipe, const std::string &data)
 
void produce_thread_report ()
 
void produce_overall_report ()
 If something goes wrong, we want to signal all threads to assemble a report Whereas USR1 is meant to be triggered externally and is caught by one thread, produce_overall_report triggers USR2 and is caught by all threads. More...
 
void handle_sigint (int)
 Handle SIGINT signals (e.g. More...
 
void handle_usr1 (int)
 
void handle_usr2 (int)
 
void handle_sigsegv (int signal_number, siginfo_t *signal_info, void *context)
 
void register_handlers (JApplication *app)
 Add special handles for system signals.
 

Variables

JApplicationg_app
 
int g_sigint_count = 0
 
JLoggerg_logger
 
std::string g_path_to_named_pipe = "/tmp/jana_status"
 
std::map< pthread_t, std::string > g_thread_reports
 
std::atomic_int g_thread_report_count
 

Detailed Description

JSignalHandler bundles together the logic for querying a JApplication about its JStatus with signal handlers for USR1, USR2, and CTRL-C.

Function Documentation

void JSignalHandler::handle_sigint ( int  )

Handle SIGINT signals (e.g.

from hitting Ctrl-C). When a SIGINT is received, JANA will try and shutdown the program cleanly, allowing the processing threads to finish up the events they are working on. The first 2 SIGINT signals received will tell JANA to shutdown gracefully. On the 3rd SIGINT, the program will try to exit immediately.

References produce_overall_report().

Referenced by register_handlers().

Here is the call graph for this function:

Here is the caller graph for this function:

void JSignalHandler::produce_overall_report ( )

If something goes wrong, we want to signal all threads to assemble a report Whereas USR1 is meant to be triggered externally and is caught by one thread, produce_overall_report triggers USR2 and is caught by all threads.

References JApplication::GetComponentSummary().

Referenced by handle_sigint().

Here is the call graph for this function:

Here is the caller graph for this function: