diff options
Diffstat (limited to 'src/common.h')
-rw-r--r-- | src/common.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h index 37f56f0..3548d5c 100644 --- a/src/common.h +++ b/src/common.h @@ -78,6 +78,18 @@ #define NEUTRAL_TEMP 6500 +/** + * Truncate a value into a bounded range + * + * @param LO The lower bound + * @param X The value to truncated + * @param UP The upper bound + * @return `X` truncated such that it is at least `LO` and at most `UP` + */ +#define CLAMP(LO, X, UP) (((LO) > (X)) ? (LO) : (((X) < (UP)) ? (X) : (UP))) + + + enum period { PERIOD_NONE = 0, PERIOD_DAYTIME, @@ -301,9 +313,20 @@ void pipeutils_signal(int write_fd); void pipeutils_handle_signal(int read_fd); +/** + * Set to 1 once the process has received a signal to terminate + */ extern volatile sig_atomic_t exiting; + +/** + * Set to 1 once the process has received a signal to remove its effect + */ extern volatile sig_atomic_t disable; + +/** + * Install signal handlers for the process + */ void signals_install_handlers(void); |