Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:01:26

0001 
0002 // Copyright 2020, Jefferson Science Associates, LLC.
0003 // Subject to the terms in the LICENSE file found in the top-level directory.
0004 
0005 #pragma once
0006 
0007 #include <csignal>
0008 #include <thread>
0009 #include <fcntl.h>
0010 #include <unistd.h>
0011 #include <sys/stat.h>
0012 
0013 #include <JANA/JApplication.h>
0014 
0015 /// JSignalHandler bundles together the logic for querying a JApplication
0016 /// about its JStatus with signal handlers for USR1, USR2, and CTRL-C.
0017 namespace JSignalHandler {
0018 
0019 extern JApplication* g_app;
0020 extern int g_sigint_count;
0021 extern JLogger* g_logger;
0022 extern std::string g_path_to_named_pipe;
0023 extern std::map<pthread_t, std::string> g_thread_reports;
0024 extern std::atomic_int g_thread_report_count;
0025 
0026 
0027 void create_named_pipe(const std::string& path_to_named_pipe);
0028 void send_to_named_pipe(const std::string& path_to_named_pipe, const std::string& data);
0029 void produce_thread_report();
0030 std::string produce_overall_report();
0031 void send_overall_report_to_named_pipe();
0032 void handle_sigint(int);
0033 void handle_usr1(int);
0034 void handle_usr2(int);
0035 void handle_sigsegv(int /*signal_number*/, siginfo_t* /*signal_info*/, void* /*context*/);
0036 void register_handlers(JApplication* app);
0037 
0038 }; // namespace JSignalHandler
0039