BRL-CAD
Loading...
Searching...
No Matches
interrupt.h
Go to the documentation of this file.
1/* I N T E R R U P T . H
2 * BRL-CAD
3 *
4 * Copyright (c) 2004-2026 United States Government as represented by
5 * the U.S. Army Research Laboratory.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * version 2.1 as published by the Free Software Foundation.
10 *
11 * This library is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this file; see the file named COPYING for more
18 * information.
19 */
20
21#ifndef BU_INTERRUPT_H
22#define BU_INTERRUPT_H
23
24#include "common.h"
25
26/* signal.h is problematic on certain versions of Xcode. It uses but doesn't
27 * define NSIG. We do the include here with the workaround and reuse this
28 * header in BRL-CAD code that needs signal.h */
29#if defined(__APPLE__) && !defined(NSIG)
30# define NSIG 32
31#endif
32#include <signal.h>
33
34
35#include "bu/defines.h"
36
37
39
40/** @addtogroup bu_env
41 *
42 * @brief Routines for managing signals.
43 *
44 * These routines provide a common means to temporarily disable and
45 * buffer signal processing during critical write operations.
46 *
47 */
48/** @{ */
49
50
51/**
52 * Defer signal processing and interrupts before critical sections.
53 *
54 * Signal processing for a variety of signals that would otherwise
55 * disrupt the logic of an application are put on hold until
56 * bu_interrupt_restore() is called.
57 *
58 * If an interrupt signal is received while suspended, it will be
59 * raised when/if interrupts are restored.
60 *
61 * Returns 0 on success.
62 * Returns non-zero on error (with perror set if signal() failure).
63 */
65
66
67/**
68 * Resume signal processing and interrupts after critical sections.
69 *
70 * If a signal was raised since bu_interrupt_suspend() was called,
71 * the previously installed signal handler will be immediately called
72 * albeit only once even if multiple signals were received.
73 *
74 * Returns 0 on success.
75 * Returns non-zero on error (with perror set if signal() failure).
76 */
78
79
80/** @} */
81
83
84#endif /* BU_INTERRUPT_H */
85
86/*
87 * Local Variables:
88 * mode: C
89 * tab-width: 8
90 * indent-tabs-mode: t
91 * c-file-style: "stroustrup"
92 * End:
93 * ex: shiftwidth=4 tabstop=8
94 */
Definition dvec.h:74
Header file for the BRL-CAD common definitions.
int bu_interrupt_suspend(void)
int bu_interrupt_restore(void)