Loading...
Searching...
No Matches
RDKit::ControlCHandler Class Reference

`#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 ()

## Detailed Description

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.

## Constructor & Destructor Documentation

## ControlCHandler() [1/3]

RDKit::ControlCHandler::ControlCHandler | ( |  | ) |

inline

Definition at line 48 of file ControlCHandler.h.

References signalHandler().

Referenced by ControlCHandler(), ControlCHandler(), operator=(), and operator=().

## ControlCHandler() [2/3]

RDKit::ControlCHandler::ControlCHandler | ( | const ControlCHandler & |  | ) |

delete

References ControlCHandler().

## ControlCHandler() [3/3]

RDKit::ControlCHandler::ControlCHandler | ( | ControlCHandler && |  | ) |

delete

References ControlCHandler().

## ~ControlCHandler()

RDKit::ControlCHandler::~ControlCHandler | ( |  | ) |

inline

Definition at line 53 of file ControlCHandler.h.

## Member Function Documentation

## getGotSignal()

bool RDKit::ControlCHandler::getGotSignal | ( |  | ) |

inline static

Definition at line 57 of file ControlCHandler.h.

## operator=() [1/2]

ControlCHandler & RDKit::ControlCHandler::operator= | ( | const ControlCHandler & |  | ) |

delete

References ControlCHandler().

## operator=() [2/2]

ControlCHandler & RDKit::ControlCHandler::operator= | ( | ControlCHandler && |  | ) |

delete

References ControlCHandler().

## reset()

void RDKit::ControlCHandler::reset | ( |  | ) |

inline static

Definition at line 64 of file ControlCHandler.h.

References signalHandler().

## signalHandler()

void RDKit::ControlCHandler::signalHandler | ( | int | signalNumber | ) |

inline static

Definition at line 58 of file ControlCHandler.h.

Referenced by ControlCHandler(), and reset().

The documentation for this class was generated from the following file:

- ControlCHandler.h