mon = lock_word_get_inflated_lock (lw);
/* Do this WaitSleepJoin check before creating the event handle */
- mono_thread_current_check_pending_interrupt ();
+ if (mono_thread_current_check_pending_interrupt ())
+ return FALSE;
event = CreateEvent (NULL, FALSE, FALSE, NULL);
if (event == NULL) {
LOCK_DEBUG (g_message ("%s: (%d) queuing handle %p", __func__, mono_thread_info_get_small_id (), event));
- mono_thread_current_check_pending_interrupt ();
+ /* This looks superfluous */
+ if (mono_thread_current_check_pending_interrupt ()) {
+ CloseHandle (event);
+ return FALSE;
+ }
mono_thread_set_state (thread, ThreadState_WaitSleepJoin);