aboutsummaryrefslogtreecommitdiff
path: root/deps/uv/src/unix/kqueue.c
diff options
context:
space:
mode:
Diffstat (limited to 'deps/uv/src/unix/kqueue.c')
-rw-r--r--deps/uv/src/unix/kqueue.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/deps/uv/src/unix/kqueue.c b/deps/uv/src/unix/kqueue.c
index b4f9f5d840..aaadcd8419 100644
--- a/deps/uv/src/unix/kqueue.c
+++ b/deps/uv/src/unix/kqueue.c
@@ -55,9 +55,11 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
unsigned int nevents;
unsigned int revents;
QUEUE* q;
+ uv__io_t* w;
+ sigset_t* pset;
+ sigset_t set;
uint64_t base;
uint64_t diff;
- uv__io_t* w;
int filter;
int fflags;
int count;
@@ -117,6 +119,13 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
w->events = w->pevents;
}
+ pset = NULL;
+ if (loop->flags & UV_LOOP_BLOCK_SIGPROF) {
+ pset = &set;
+ sigemptyset(pset);
+ sigaddset(pset, SIGPROF);
+ }
+
assert(timeout >= -1);
base = loop->time;
count = 48; /* Benchmarks suggest this gives the best throughput. */
@@ -127,6 +136,9 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
spec.tv_nsec = (timeout % 1000) * 1000000;
}
+ if (pset != NULL)
+ pthread_sigmask(SIG_BLOCK, pset, NULL);
+
nfds = kevent(loop->backend_fd,
events,
nevents,
@@ -134,6 +146,9 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
ARRAY_SIZE(events),
timeout == -1 ? NULL : &spec);
+ if (pset != NULL)
+ pthread_sigmask(SIG_UNBLOCK, pset, NULL);
+
/* Update loop->time unconditionally. It's tempting to skip the update when
* timeout == 0 (i.e. non-blocking poll) but there is no guarantee that the
* operating system didn't reschedule our process while in the syscall.