![]() |
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 38 of file ControlCHandler.h.
|
inline |
Definition at line 40 of file ControlCHandler.h.
References RDKit::rdvalue_is(), and signalHandler().
|
delete |
|
delete |
|
inline |
Definition at line 45 of file ControlCHandler.h.
References RDKit::rdvalue_is().
Definition at line 49 of file ControlCHandler.h.
|
delete |
|
delete |
Definition at line 56 of file ControlCHandler.h.
References RDKit::rdvalue_is(), and signalHandler().
Definition at line 50 of file ControlCHandler.h.
References RDKit::rdvalue_is().
Referenced by ControlCHandler(), and reset().