BRL-CAD
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-2023 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#include "bu/defines.h"
27
28
29__BEGIN_DECLS
30
31/** @addtogroup bu_env
32 *
33 * @brief Routines for managing signals.
34 *
35 * These routines provide a common means to temporarily disable and
36 * buffer signal processing during critical write operations.
37 *
38 */
39/** @{ */
40
41
42/**
43 * Defer signal processing and interrupts before critical sections.
44 *
45 * Signal processing for a variety of signals that would otherwise
46 * disrupt the logic of an application are put on hold until
47 * bu_interrupt_restore() is called.
48 *
49 * If an interrupt signal is received while suspended, it will be
50 * raised when/if interrupts are restored.
51 *
52 * Returns 0 on success.
53 * Returns non-zero on error (with perror set if signal() failure).
54 */
55BU_EXPORT extern int bu_interrupt_suspend(void);
56
57
58/**
59 * Resume signal processing and interrupts after critical sections.
60 *
61 * If a signal was raised since bu_interrupt_suspend() was called,
62 * the previously installed signal handler will be immediately called
63 * albeit only once even if multiple signals were received.
64 *
65 * Returns 0 on success.
66 * Returns non-zero on error (with perror set if signal() failure).
67 */
68BU_EXPORT extern int bu_interrupt_restore(void);
69
70
71/** @} */
72
73__END_DECLS
74
75#endif /* BU_INTERRUPT_H */
76
77/*
78 * Local Variables:
79 * mode: C
80 * tab-width: 8
81 * indent-tabs-mode: t
82 * c-file-style: "stroustrup"
83 * End:
84 * ex: shiftwidth=4 tabstop=8
85 */
Header file for the BRL-CAD common definitions.
int bu_interrupt_suspend(void)
int bu_interrupt_restore(void)