Scippy

SCIP

Solving Constraint Integer Programs

Detailed Description

methods and datastructures for catching the user CTRL-C interrupt

Author
Tobias Achterberg

Definition in file interrupt.c.

#include <assert.h>
#include <sys/types.h>
#include <stdlib.h>
#include <signal.h>
#include "scip/def.h"
#include "scip/pub_message.h"
#include "blockmemshell/memory.h"
#include "scip/interrupt.h"

Go to the source code of this file.

Data Structures

struct  SCIP_Interrupt
 

Functions

static void interruptHandler (int signum)
 
SCIP_RETCODE SCIPinterruptCreate (SCIP_INTERRUPT **interrupt)
 
void SCIPinterruptFree (SCIP_INTERRUPT **interrupt)
 
void SCIPinterruptCapture (SCIP_INTERRUPT *interrupt)
 
void SCIPinterruptRelease (SCIP_INTERRUPT *interrupt)
 
SCIP_Bool SCIPinterrupted (void)
 
SCIP_Bool SCIPterminated (void)
 
void SCIPtryTerminate (void)
 
void SCIPresetInterrupted (void)
 

Variables

static volatile int ninterrupts = 0
 
static volatile int nterms = 0
 

Function Documentation

◆ interruptHandler()

static void interruptHandler ( int  signum)
static

interrupt handler for CTRL-C interrupts

Parameters
signuminterrupt signal number

Definition at line 63 of file interrupt.c.

References ninterrupts, and SCIP_UNUSED.

Referenced by SCIPinterruptCapture().

◆ SCIPinterruptCreate()

SCIP_RETCODE SCIPinterruptCreate ( SCIP_INTERRUPT **  interrupt)

creates a CTRL-C interrupt data

Parameters
interruptpointer to store the CTRL-C interrupt data

Definition at line 82 of file interrupt.c.

References BMSallocMemory, NULL, SCIP_ALLOC, and SCIP_OKAY.

Referenced by doScipCreate().

◆ SCIPinterruptFree()

void SCIPinterruptFree ( SCIP_INTERRUPT **  interrupt)

frees a CTRL-C interrupt data

Parameters
interruptpointer to the CTRL-C interrupt data

Definition at line 95 of file interrupt.c.

References BMSfreeMemory, and NULL.

Referenced by SCIPfree().

◆ SCIPinterruptCapture()

void SCIPinterruptCapture ( SCIP_INTERRUPT interrupt)

captures the CTRL-C interrupt to call the SCIP's own interrupt handler

Parameters
interruptCTRL-C interrupt data

Definition at line 105 of file interrupt.c.

References interruptHandler(), ninterrupts, nterms, NULL, SCIP_Interrupt::nuses, and SCIP_Interrupt::oldsigaction.

Referenced by SCIPpresolve(), and SCIPsolve().

◆ SCIPinterruptRelease()

void SCIPinterruptRelease ( SCIP_INTERRUPT interrupt)

releases the CTRL-C interrupt and restores the old interrupt handler

Parameters
interruptCTRL-C interrupt data

Definition at line 135 of file interrupt.c.

References NULL, SCIP_Interrupt::nuses, and SCIP_Interrupt::oldsigaction.

Referenced by SCIPpresolve(), and SCIPsolve().

◆ SCIPinterrupted()

SCIP_Bool SCIPinterrupted ( void  )

returns whether the user interrupted by pressing CTRL-C

Definition at line 154 of file interrupt.c.

References ninterrupts.

Referenced by SCIPpressedCtrlC(), and SCIPsolveIsStopped().

◆ SCIPterminated()

SCIP_Bool SCIPterminated ( void  )

returns whether a process termination signal was received

Definition at line 162 of file interrupt.c.

References nterms.

Referenced by SCIPsolveIsStopped().

◆ SCIPtryTerminate()

void SCIPtryTerminate ( void  )

sends a termination signal to all SCIP processes so that they try to terminate as soon as possible

Note
For terminating a specific SCIP process use SCIPinterruptSolve().

Definition at line 173 of file interrupt.c.

References nterms.

Referenced by handleSigterm().

◆ SCIPresetInterrupted()

void SCIPresetInterrupted ( void  )

resets the number of interrupts to 0

Definition at line 181 of file interrupt.c.

References ninterrupts, and nterms.

Referenced by SCIPsolveIsStopped().

Variable Documentation

◆ ninterrupts

volatile int ninterrupts = 0
static

static variable counting the number of CTRL-C interrupts

Definition at line 36 of file interrupt.c.

Referenced by interruptHandler(), SCIPinterruptCapture(), SCIPinterrupted(), and SCIPresetInterrupted().

◆ nterms

volatile int nterms = 0
static

static variable counting the number of times that the process received a SIGTERM signal

Definition at line 38 of file interrupt.c.

Referenced by allExtensionsAreInvalid(), boundPruneHeur(), boundPruneHeurMw(), computeDegConsTree(), computeStarts(), computeSteinerTree(), computeSteinerTree_execPcMwFull(), computeSteinerTreeKeyNodesCsr(), computeSteinerTreeVnoi(), createAndAddAnds(), createDisaggrRow(), createNlhdlrExprData(), cutNodesGetLastCutnode(), daExec(), daOrderRoots(), dapathsIsPromising(), detectSocNorm(), detectSocQuadraticComplex(), detectSocQuadraticSimple(), distgraphGetNedges(), dpborder_coreUpdateOrdering(), dpgraphInit(), dpsolverInitData(), dpterms_streeInit(), dualascent_execPcMw(), evalSingleTerm(), findAggregation(), generateCutSolDisagg(), generateCutSolSOC(), getBiasedMw(), getBilinearBinaryTerms(), getFactorizedBinaryQuadraticExpr(), graph_getTerms(), graph_grid_create(), graph_obstgrid_create(), graph_path_st(), graph_path_st_pcmw(), graph_path_st_pcmw_extend(), graph_path_st_pcmw_extendBiased(), graph_path_st_pcmw_full(), graph_path_st_rpcmw(), graph_printInfoReduced(), graph_transMw(), graph_transPcGetSap(), graph_transRpc(), graph_transRpc2FixedProper(), graph_valid(), graph_validInput(), graph_voronoiWithRadius(), graph_voronoiWithRadiusMw(), insertData(), log2floor(), pcmwGetStartNodes(), pseudodeleteBiasedIsPromising(), readLinearCoefs(), redcostGetNTermsMarked(), reduce_bound(), reduce_boundHop(), reduce_boundHopR(), reduce_boundMw(), reduce_mw(), reduce_nv(), reduce_nvAdv(), reduce_pc(), reduce_sd(), reduce_sdneighborGetCloseTerms(), reduce_sdPc(), reduce_stp(), runDualAscent(), SCIP_DECL_CONSSEPALP(), SCIP_DECL_NLHDLRINITSEPA(), SCIPcreateConsBasicPseudoboolean(), SCIPcreateConsPseudoboolean(), SCIPfreeSOCArraysNonlinear(), SCIPinterruptCapture(), SCIPresetInterrupted(), SCIPStpHeurTMCompStarts(), SCIPterminated(), SCIPtryTerminate(), sdgraphAlloc(), sdgraphAllocRestricted(), sdqueryAttachBinaryTreeNode(), sdqueryBuildBinaryTree(), sdqueryFullInit(), sdqueryGetRmqLength(), sdqueryLcaBuilderInit(), sdqueryRmqInit(), sepaBadGetZeroHalfMaxrounds(), shortestpath_pcInit(), solstp_isValid(), subtreesAddNew(), termsepaCsrGetMaxNnodes(), and tmVnoiInit().