William A. Kennington III | 9c97d2c | 2018-11-02 17:25:36 -0700 | [diff] [blame] | 1 | #include <signal.h> |
| 2 | #include <stdplus/signal.hpp> |
William A. Kennington III | 6472503 | 2019-07-01 17:53:13 -0700 | [diff] [blame] | 3 | #include <stdplus/util/cexec.hpp> |
William A. Kennington III | 9c97d2c | 2018-11-02 17:25:36 -0700 | [diff] [blame] | 4 | #include <system_error> |
| 5 | |
| 6 | namespace stdplus |
| 7 | { |
| 8 | namespace signal |
| 9 | { |
| 10 | |
| 11 | void block(int signum) |
| 12 | { |
| 13 | sigset_t set; |
William A. Kennington III | 80c988f | 2020-08-02 02:54:22 -0700 | [diff] [blame] | 14 | CHECK_ERRNO(sigprocmask(SIG_BLOCK, nullptr, &set), "sigprocmask get"); |
| 15 | CHECK_ERRNO(sigaddset(&set, signum), "sigaddset"); |
| 16 | CHECK_ERRNO(sigprocmask(SIG_BLOCK, &set, nullptr), "sigprocmask set"); |
William A. Kennington III | 9c97d2c | 2018-11-02 17:25:36 -0700 | [diff] [blame] | 17 | } |
| 18 | |
| 19 | } // namespace signal |
| 20 | } // namespace stdplus |