JANA2
C++ framework for multi-threaded data processing
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 ()
 
std::string 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.
 
void send_overall_report_to_named_pipe ()
 
void handle_sigint (int)
 Handle SIGINT signals (e.g. More...
 
void handle_usr1 (int)
 
void handle_usr2 (int)
 
void handle_sigsegv (int, siginfo_t *, void *)
 
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

◆ handle_sigint()

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.

Referenced by register_handlers().