rlib
Convenience library for useful things
Loading...
Searching...
No Matches
rsignal.h
Go to the documentation of this file.
1/* RLIB - Convenience library for useful things
2 * Copyright (C) 2015 Haakon Sporsheim <haakon.sporsheim@gmail.com>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 3.0 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library.
16 * See the COPYING file at the root of the source repository.
17 */
18#ifndef __R_SIGNAL_H__
19#define __R_SIGNAL_H__
20
21#if !defined(__RLIB_H_INCLUDE_GUARD__) && !defined(RLIB_COMPILATION)
22#error "#include <rlib.h> only please."
23#endif
24
30#include <rlib/rtypes.h>
31#include <rlib/rtime.h>
32
48
50typedef void (*RSignalFunc) (int sig);
53
56 RSignalFunc func);
59 RSignalFunc func);
67 RClockTime interval, RSignalFunc func);
68
73
74R_END_DECLS
75
78#endif /* __R_SIGNAL_H__ */
79
#define R_API
Public-API decoration: resolves to R_API_EXPORT while building rlib and R_API_IMPORT for consumers.
Definition rmacros.h:115
#define R_BEGIN_DECLS
Open an extern "C" block under C++ (no-op in C).
Definition rmacros.h:196
struct RSigAlrmTimer RSigAlrmTimer
Opaque SIGALRM timer handle.
Definition rsignal.h:52
void r_sig_alrm_timer_cancel(RSigAlrmTimer *timer)
Disarm and free timer (frees via r_sig_alrm_timer_delete).
void(* RSignalFunc)(int sig)
Signal-handler callback; receives the delivered signal number.
Definition rsignal.h:50
RSigAlrmTimer * r_sig_alrm_timer_new_interval(RClockTime interval, RSignalFunc func)
Arm a recurring timer firing every interval.
RSigAlrmTimer * r_sig_alrm_timer_new_interval_delayed(RClockTime timeout, RClockTime interval, RSignalFunc func)
Arm a recurring timer with an initial delay.
RSigAlrmTimer * r_sig_alrm_timer_new_oneshot(RClockTime timeout, RSignalFunc func)
Arm a one-shot timer firing once after timeout.
void r_sig_alrm_timer_delete(RSigAlrmTimer *timer)
Free timer, restoring the previous SIGALRM handler.
ruint64 RClockTime
Unsigned 64-bit timestamp / duration, in nanoseconds.
Definition rtypes.h:353
Time units, monotonic / wall-clock timestamps, calendar helpers and printf-friendly time-formatting m...
Foundational type aliases used by every rlib header.