Skip to content

Commit 2bf0921

Browse files
committed
apply Pierre's fix of using pthread_kill instead of raise in the signal handler
1 parent e194202 commit 2bf0921

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/event/event_epoll.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ _dispatch_muxnote_dispose(dispatch_muxnote_t dmn)
117117
free(dmn);
118118
}
119119

120+
static pthread_t manager_thread;
121+
120122
static void
121123
_dispatch_muxnote_signal_block_and_raise(int signo)
122124
{
@@ -125,7 +127,7 @@ _dispatch_muxnote_signal_block_and_raise(int signo)
125127
// receive them. Fix that by lazily noticing, blocking said signal,
126128
// and raising the signal again when it happens
127129
_dispatch_sigmask();
128-
raise(signo);
130+
pthread_kill(manager_thread, signo);
129131
}
130132

131133
static dispatch_muxnote_t
@@ -147,6 +149,7 @@ _dispatch_muxnote_create(dispatch_unote_t du, uint32_t events)
147149
switch (filter) {
148150
case EVFILT_SIGNAL:
149151
if (!sigismember(&signals_with_unotes, du._du->du_ident)) {
152+
manager_thread = pthread_self();
150153
sigaddset(&signals_with_unotes, du._du->du_ident);
151154
sigaction(du._du->du_ident, &sa, NULL);
152155
}

0 commit comments

Comments
 (0)