CSignal Class Reference

Inheritance diagram for CSignal:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 CSignal ()
 ~CSignal ()

Static Public Member Functions

static void handler (int signal)
static bool set_handler ()
static bool unset_handler ()
static void clear ()
static void clear_cancel ()
static bool cancel_computations ()

Static Protected Attributes

static int signals [NUMTRAPPEDSIGS] = {SIGINT, SIGURG}
static struct sigaction oldsigaction [NUMTRAPPEDSIGS]
static bool active = false
static bool cancel_computation = false


Detailed Description

Class Signal implements signal handling to e.g. allow ctrl+c to cancel a long running process. This is done in two ways:

  1. A signal handler is attached to trap the SIGINT and SIGURG signal. Pressing ctrl+c or sending the SIGINT (kill ...) signal to the shogun process will make shogun print a message asking to immediately exit the running method and to fall back to the command line.
  2. When an URG signal is received or ctrl+c P is pressed shogun will prematurely stop a method and continue execution. For example when an SVM solver takes a long time without progressing much, one might still be interested in the result and should thus send SIGURG or interactively prematurely stop the method

Definition at line 36 of file Signal.h.


Constructor & Destructor Documentation

CSignal::CSignal (  ) 

default constructor

Definition at line 32 of file Signal.cpp.

CSignal::~CSignal (  ) 

Definition at line 37 of file Signal.cpp.


Member Function Documentation

static bool CSignal::cancel_computations (  )  [static]

cancel computations

Returns:
if computations could be cancelled

Definition at line 71 of file Signal.h.

void CSignal::clear (  )  [static]

clear signals

Definition at line 156 of file Signal.cpp.

void CSignal::clear_cancel (  )  [static]

clear cancel flag signals

Definition at line 151 of file Signal.cpp.

void CSignal::handler ( int  signal  )  [static]

handler

Parameters:
signal signal number

Definition at line 43 of file Signal.cpp.

bool CSignal::set_handler (  )  [static]

set handler

Returns:
if setting was successful

Definition at line 89 of file Signal.cpp.

bool CSignal::unset_handler (  )  [static]

unset handler

Returns:
if unsetting was successful

Definition at line 127 of file Signal.cpp.


Member Data Documentation

bool CSignal::active = false [static, read, protected]

active signal

Definition at line 101 of file Signal.h.

bool CSignal::cancel_computation = false [static, protected]

if computation is cancelled

Definition at line 104 of file Signal.h.

struct sigaction CSignal::oldsigaction[NUMTRAPPEDSIGS] [static, read, protected]

signal actions

Definition at line 98 of file Signal.h.

int CSignal::signals = {SIGINT, SIGURG} [static, protected]

signals; handling external lib

Definition at line 95 of file Signal.h.


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

SHOGUN Machine Learning Toolbox - Documentation