From ca9e4a836e9f86b650d432093b2cb67e20b977cd Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Tue, 1 Nov 2016 14:45:47 -0400 Subject: [threads] Fix Posix async resume (#3861) If we fail to send the signal, we should not add a pending operation, as the signal handler is never going to answer this operation (via mono_threads_notify_initiator_of_resume). --- mono/utils/mono-threads-posix.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mono/utils/mono-threads-posix.c b/mono/utils/mono-threads-posix.c index ce2f58ad138..de38adf1373 100644 --- a/mono/utils/mono-threads-posix.c +++ b/mono/utils/mono-threads-posix.c @@ -456,8 +456,13 @@ This begins async resume. This function must do the following: gboolean mono_threads_suspend_begin_async_resume (MonoThreadInfo *info) { - mono_threads_add_to_pending_operation_set (info); - return mono_threads_pthread_kill (info, mono_threads_posix_get_restart_signal ()) == 0; + int sig = mono_threads_posix_get_restart_signal (); + + if (!mono_threads_pthread_kill (info, sig)) { + mono_threads_add_to_pending_operation_set (info); + return TRUE; + } + return FALSE; } void -- cgit v1.2.3