You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello.
I'm writing simple http-server which processes some signals such as
SIGUSRx, and using SP_LFServer for it (like in testhttp.cpp). But I've
found that my server shuts down on the next request after it received
SIGUSRx signal. After some investigation I've found that SP_LFServer uses
pause() in SP_LFServer::runForever(), which "causes the calling process (or
thread) to sleep until a signal is delivered that either terminates the
process or causes the invocation of a signal-catching function", which is
my case. Isn't is more convenient to use sigwait(), specifying SIGKILL and
SIGTERM for it, than simple pause()? Below is the code I'm using and it
seems it works for me.
void SP_LFServer :: runForever()
{
run();
sigset_t ss;
sigemptyset(&ss);
sigaddset(&ss, SIGKILL);
sigaddset(&ss, SIGTERM);
int signum;
sigwait(&ss, &signum);
struct sigaction sa;
sigaction(signum, 0, &sa);
sa.sa_handler(signum);
//pause();
}
Original issue reported on code.google.com by artem.iglikov on 2 Feb 2010 at 3:12
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
artem.iglikov
on 2 Feb 2010 at 3:12The text was updated successfully, but these errors were encountered: