Scippy

SCIP

Solving Constraint Integer Programs

interrupt.c File Reference

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 "blockmemshell/memory.h"
#include "scip/interrupt.h"

Go to the source code of this file.

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)
 
void SCIPresetInterrupted (void)
 

Variables

static volatile int ninterrupts = 0
 

Function Documentation

◆ interruptHandler()

static void interruptHandler ( int  signum)
static

interrupt handler for CTRL-C interrupts

Parameters
signuminterrupt signal number

Definition at line 59 of file interrupt.c.

References ninterrupts.

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 76 of file interrupt.c.

References BMSallocMemory, NULL, SCIP_ALLOC, and SCIP_OKAY.

Referenced by SCIPcreate().

◆ SCIPinterruptFree()

void SCIPinterruptFree ( SCIP_INTERRUPT **  interrupt)

frees a CTRL-C interrupt data

Parameters
interruptpointer to the CTRL-C interrupt data

Definition at line 89 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 99 of file interrupt.c.

References interruptHandler(), ninterrupts, 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 128 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 147 of file interrupt.c.

References ninterrupts.

Referenced by SCIPpressedCtrlC(), SCIPsetModifiedDefaultSettingsIpopt(), and SCIPsolveIsStopped().

◆ SCIPresetInterrupted()

void SCIPresetInterrupted ( void  )

resets the number of interrupts to 0

Definition at line 155 of file interrupt.c.

References ninterrupts.

Referenced by SCIPsolveIsStopped().

Variable Documentation

◆ ninterrupts

volatile int ninterrupts = 0
static

static variable counting the number of CTRL-C interrupts

Definition at line 34 of file interrupt.c.

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