Public Types | |
typedef void(* | cleanup_function )(void) |
Static Public Member Functions | |
static void | StopFactorization () |
cancel all registered thread, clean-up resources and exit the program | |
static void | register_cancel (const pthread_t tid=pthread_self()) |
register a thread for possible cancellation | |
static void | unregister_cancel (const pthread_t tid=pthread_self()) |
unregister a thread for cancellation | |
static void | cancel_registered_threads () |
cancel all registered threads | |
static void | register_exithandler (cleanup_function a_cleanup_function) |
register an exithandler | |
static void | StopFactorization () |
Static Private Attributes | |
static stack< cleanup_function > | cleanup_functions |
static CMutex | Mutex |
static CMutex | AliveMutex |
This class manages the ordered exiting of the program after the factorization has been ended or aborted by program flow. For one reason, there are some data structures (files, etc.) that should be closed and even deleted. The other reason is, that in server mode there may be some threads running unaware of the fact, that factorization has stopped. So the general idea of this manager class is to notify or cancel these threads, too...
Definition at line 26 of file easy_factor.cc.
typedef void(* ExitManager::cleanup_function)(void) |
void ExitManager::StopFactorization | ( | ) | [static] |
cancel all registered thread, clean-up resources and exit the program
Definition at line 118 of file ExitManager.cc.
References AliveMutex, std::basic_string< _CharT, _Traits, _Alloc >::c_str(), cancel_registered_threads(), catch_sigint(), cleanup_functions, cout, endl(), exit(), flush(), FoundFactors, CMutex::lock(), MARK, TFoundFactors::PrettyPrint(), PrintSummary, statistical_data::StatusReport(), XML_StatusFile, and statistical_data::XML_StatusReport().
Referenced by easy_factor(), StaticRelations::insert(), Cprocess_clients::process_data_stream(), Cprocess_clients::process_data_stream_ecm(), and process_ecm().
void ExitManager::register_cancel | ( | const pthread_t | tid = pthread_self() |
) | [static] |
register a thread for possible cancellation
Definition at line 58 of file ExitManager.cc.
References CMutex::lock(), Mutex, and CMutex::unlock().
Referenced by Cprocess_clients::THREAD_process_data_stream(), and CXML_StatusServer::THREAD_XML_StatusServer().
void ExitManager::unregister_cancel | ( | const pthread_t | tid = pthread_self() |
) | [static] |
unregister a thread for cancellation
Definition at line 66 of file ExitManager.cc.
References CMutex::lock(), Mutex, and CMutex::unlock().
Referenced by Cprocess_clients::THREAD_process_data_stream().
void ExitManager::cancel_registered_threads | ( | ) | [static] |
cancel all registered threads
Definition at line 74 of file ExitManager.cc.
References cerr, cout, endl(), CMutex::lock(), Mutex, and CMutex::unlock().
Referenced by StopFactorization().
void ExitManager::register_exithandler | ( | cleanup_function | a_cleanup_function | ) | [static] |
register an exithandler
Definition at line 97 of file ExitManager.cc.
References cleanup_functions.
Referenced by main().
static void ExitManager::StopFactorization | ( | ) | [static] |
stack< ExitManager::cleanup_function > ExitManager::cleanup_functions [static, private] |
Definition at line 31 of file ExitManager.cc.
Referenced by register_exithandler(), and StopFactorization().
CMutex ExitManager::Mutex [static, private] |
Definition at line 33 of file ExitManager.cc.
Referenced by cancel_registered_threads(), register_cancel(), and unregister_cancel().
CMutex ExitManager::AliveMutex [static, private] |