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