diff options
author | Andy Green <andy.green@linaro.org> | 2014-01-11 12:37:07 +0800 |
---|---|---|
committer | Andy Green <andy.green@linaro.org> | 2014-01-11 12:37:07 +0800 |
commit | ed451d5cbf1c46d889e800ff86b9e2e3c9de0d6e (patch) | |
tree | 36c2f11acd5c84c036a255e0b4eb5973da51c9d3 /lib | |
parent | 3b3fa9e2086da6157289141e0b6fe1e5035bad25 (diff) | |
download | libwebsockets-ed451d5cbf1c46d889e800ff86b9e2e3c9de0d6e.tar.gz |
ppoll fix signal mask sense
Signed-off-by: Andy Green <andy.green@linaro.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libwebsockets.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index 6dc4d1d1..01dc58ee 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -1354,8 +1354,9 @@ libwebsocket_service(struct libwebsocket_context *context, int timeout_ms) timeout_ts.tv_sec = timeout_ms / 1000; timeout_ts.tv_nsec = timeout_ms % 1000; - sigemptyset(&sigmask); - sigaddset(&sigmask, SIGUSR2); + + sigprocmask(SIG_BLOCK, NULL, &sigmask); + sigdelset(&sigmask, SIGUSR2); /* wait for something to need service */ @@ -1369,8 +1370,12 @@ libwebsocket_service(struct libwebsocket_context *context, int timeout_ms) return 0; } - if (n < 0) - return -1; + if (n < 0) { + if (errno != EINTR) + return -1; + else + return 0; + } /* any socket with events to service? */ @@ -2100,6 +2105,13 @@ libwebsocket_create_context(struct lws_context_creation_info *info) } signal(SIGUSR2, lws_sigusr2); + { + sigset_t mask; + sigemptyset (&mask); + sigaddset (&mask, SIGUSR2); + + sigprocmask(SIG_BLOCK, &mask, NULL); + } #ifdef SSL_OP_NO_COMPRESSION SSL_CTX_set_options(context->ssl_ctx, SSL_OP_NO_COMPRESSION); |