blob: 749e8e78d640545e4bc20eca723e2ed7f037b792 [file] [log] [blame]
Austin Schuh9049e202022-02-20 17:34:16 -08001/*
2 * Interface for OSQP signal handling.
3 */
4
5#ifndef CTRLC_H
6# define CTRLC_H
7
8# ifdef __cplusplus
9extern "C" {
10# endif // ifdef __cplusplus
11
12# include "glob_opts.h"
13
14# if defined MATLAB
15
16/* No header file available here; define the prototypes ourselves */
17bool utIsInterruptPending(void);
18bool utSetInterruptEnabled(bool);
19
20# elif defined IS_WINDOWS
21
22/* Use Windows SetConsoleCtrlHandler for signal handling */
23# include <windows.h>
24
25# else // if defined MATLAB
26
27/* Use sigaction for signal handling on non-Windows machines */
28# include <signal.h>
29
30# endif // if defined MATLAB
31
32/* METHODS are the same for both */
33
34/**
35 * Start listener for ctrl-c interrupts
36 */
37void osqp_start_interrupt_listener(void);
38
39/**
40 * End listener for ctrl-c interrupts
41 */
42void osqp_end_interrupt_listener(void);
43
44/**
45 * Check if the solver has been interrupted
46 * @return Boolean indicating if the solver has been interrupted
47 */
48int osqp_is_interrupted(void);
49
50
51# ifdef __cplusplus
52}
53# endif // ifdef __cplusplus
54
55
56#endif /* END IFDEF CTRLC */