![]() |
RDKit
Open-source cheminformatics and machine learning.
|
#include <ControlCHandler.h>
Public Member Functions | |
| ControlCHandler () | |
| ControlCHandler (const ControlCHandler &)=delete | |
| ControlCHandler (ControlCHandler &&)=delete | |
| ControlCHandler & | operator= (const ControlCHandler &)=delete |
| ControlCHandler & | operator= (ControlCHandler &&)=delete |
| ~ControlCHandler () | |
Static Public Member Functions | |
| static bool | getGotSignal () |
| static void | signalHandler (int signalNumber) |
| static void | reset () |
This class catches a control-C/SIGINT and sets the flag d_gotSignal if one is received. It is intended to be used inside a long C++ calculation called from Python which intercepts the signal handler. The C++ code must check the value of d_gotSignal periodically and act accordingly. The destructor resets the signal handler and flag for next use, which is essential because it's a static variable. Example usage, inside a boost::python wrapper: ResultsObject results; { NOGIL gil; results = someFunction(); } if (results.getCancelled()) { throw_runtime_error("someFunction cancelled"); } It's important that the exception is thrown once the GIL has been released, otherwise a crash is inevitable at some future point.
Definition at line 46 of file ControlCHandler.h.
|
inline |
Definition at line 48 of file ControlCHandler.h.
References signalHandler().
Referenced by ControlCHandler(), ControlCHandler(), operator=(), and operator=().
|
delete |
References ControlCHandler().
|
delete |
References ControlCHandler().
|
inline |
Definition at line 53 of file ControlCHandler.h.
|
inlinestatic |
Definition at line 57 of file ControlCHandler.h.
|
delete |
References ControlCHandler().
|
delete |
References ControlCHandler().
|
inlinestatic |
Definition at line 64 of file ControlCHandler.h.
References signalHandler().
|
inlinestatic |
Definition at line 58 of file ControlCHandler.h.
Referenced by ControlCHandler(), and reset().