8000 SP_LFServer shutdowns on any catched signal (including SIGUSRx) · Issue #28 · spsoft/spserver · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

SP_LFServer shutdowns on any catched signal (including SIGUSRx) #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
GoogleCodeExporter opened this issue Mar 14, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant
0