blob: 525f2c08f549c69a15aef930ecfe3508e79ea53e [file] [log] [blame]
William A. Kennington III9c97d2c2018-11-02 17:25:36 -07001#include <signal.h>
2#include <stdplus/signal.hpp>
William A. Kennington III64725032019-07-01 17:53:13 -07003#include <stdplus/util/cexec.hpp>
William A. Kennington III9c97d2c2018-11-02 17:25:36 -07004#include <system_error>
5
6namespace stdplus
7{
8namespace signal
9{
10
11void block(int signum)
12{
13 sigset_t set;
William A. Kennington III80c988f2020-08-02 02:54:22 -070014 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 III9c97d2c2018-11-02 17:25:36 -070017}
18
19} // namespace signal
20} // namespace stdplus