xref: /haiku/src/system/libroot/posix/signal/sigpause.cpp (revision d46a010c43680f56495b4d8afaf3f7d357f9c5ac)
1*d46a010cSIngo Weinhold /*
2*d46a010cSIngo Weinhold  * Copyright 2008, Vasilis Kaoutsis, kaoutsis@sch.gr
3*d46a010cSIngo Weinhold  * Distributed under the terms of the MIT License.
4*d46a010cSIngo Weinhold  */
5*d46a010cSIngo Weinhold 
6*d46a010cSIngo Weinhold 
7*d46a010cSIngo Weinhold #include <signal.h>
8*d46a010cSIngo Weinhold 
9*d46a010cSIngo Weinhold 
10*d46a010cSIngo Weinhold int
11*d46a010cSIngo Weinhold sigpause(int signal)
12*d46a010cSIngo Weinhold {
13*d46a010cSIngo Weinhold 	sigset_t processSignalSet;
14*d46a010cSIngo Weinhold 
15*d46a010cSIngo Weinhold 	if (sigprocmask(SIG_SETMASK, NULL, &processSignalSet) == -1)
16*d46a010cSIngo Weinhold 		return -1;
17*d46a010cSIngo Weinhold 
18*d46a010cSIngo Weinhold 	if (sigdelset(&processSignalSet, signal) == -1)
19*d46a010cSIngo Weinhold 		return -1;
20*d46a010cSIngo Weinhold 
21*d46a010cSIngo Weinhold 	return sigsuspend(&processSignalSet);
22*d46a010cSIngo Weinhold }
23