List of all members | Static Public Member Functions | Static Public Attributes
casadi::InterruptHandler Class Reference

Takes care of user interrupts (Ctrl+C) More...

#include <casadi_interrupt.hpp>

Detailed Description

This is an internal class.

Author
Joris Gillis
Date
2015

Extra doc: https://github.com/casadi/casadi/wiki/L_23l

Definition at line 47 of file casadi_interrupt.hpp.

Static Public Member Functions

static bool is_main_thread ()
 Are we in the main thread? More...
 
static void check ()
 Raises an error if an interrupt was captured. More...
 

Static Public Attributes

static bool(* checkInterrupted )()
 The routine that is used for checking interrupts. More...
 
static void(* clearInterrupted )()
 The routine that is used for clearing interrupts. More...
 

Member Function Documentation

◆ check()

static void casadi::InterruptHandler::check ( )
inlinestatic

Definition at line 71 of file casadi_interrupt.hpp.

71  {
72  if (checkInterrupted()) {
74  throw KeyboardInterruptException();
75  }
76  }
static void(* clearInterrupted)()
The routine that is used for clearing interrupts.
static bool(* checkInterrupted)()
The routine that is used for checking interrupts.

Referenced by casadi::OracleFunction::calc_function(), casadi::MXFunction::disp_more(), casadi::SXFunction::disp_more(), casadi::Matrix< Scalar >::print_sparse(), casadi::Ipqp::solve(), and casadi::Qrqp::solve().

◆ is_main_thread()

bool casadi::InterruptHandler::is_main_thread ( )
static

Definition at line 44 of file casadi_interrupt.cpp.

44  {
45 #ifdef CASADI_WITH_THREAD
46  static std::thread::id main = std::this_thread::get_id();
47  return std::this_thread::get_id()==main;
48 #else //CASADI_WITH_THREAD
49  return true;
50 #endif //CASADI_WITH_THREAD
51  }

Member Data Documentation

◆ checkInterrupted

bool(* casadi::InterruptHandler::checkInterrupted)()
static
Initial value:
=
InterruptHandler::checkInterruptedDefault

Definition at line 63 of file casadi_interrupt.hpp.

◆ clearInterrupted

void(* casadi::InterruptHandler::clearInterrupted)()
static
Initial value:
=
InterruptHandler::clearInterruptedDefault

Definition at line 65 of file casadi_interrupt.hpp.


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