[os-event] Fix set operation
authorLudovic Henry <ludovic@xamarin.com>
Fri, 4 Nov 2016 14:43:44 +0000 (10:43 -0400)
committerLudovic Henry <ludovic@xamarin.com>
Fri, 4 Nov 2016 14:46:19 +0000 (10:46 -0400)
This is a logic bug where we would only wake up one of the threads that are waiting for the manual MonoOSEvent to be set. This would be a problem only if more than one thread is waiting.

mono/utils/os-event-unix.c

index 12ef05c26978b023e3fee21fe8b40be76bbafa4e..a2678b4f949180c4530bc4a6bab5e009e4b8aad1 100644 (file)
@@ -80,10 +80,10 @@ mono_os_event_set (MonoOSEvent *event)
        mono_os_mutex_lock (&event->mutex);
 
        if (event->manual) {
-               mono_os_event_signal (event, FALSE);
+               mono_os_event_signal (event, TRUE);
        } else {
                event->set_count = 1;
-               mono_os_event_signal (event, TRUE);
+               mono_os_event_signal (event, FALSE);
        }
 
        mono_os_mutex_unlock (&event->mutex);