* We pass TRUE instead of allow_interruption since we have to check for the
* StopRequested case below.
*/
+ MONO_PREPARE_BLOCKING
ret = WaitForSingleObjectEx (mon->entry_sem, waitms, TRUE);
+ MONO_FINISH_BLOCKING
mono_thread_clr_state (thread, ThreadState_WaitSleepJoin);
LockWord lw;
lw.sync = mon;
if (lw.lock_word & LOCK_WORD_THIN_HASH) {
- mono_raise_exception (mono_get_exception_synchronization_lock ("Not locked"));
+ mono_set_pending_exception (mono_get_exception_synchronization_lock ("Not locked"));
return;
}
lw.lock_word &= ~LOCK_WORD_BITS_MASK;
}
#endif
if (mon == NULL) {
- mono_raise_exception (mono_get_exception_synchronization_lock ("Not locked"));
+ mono_set_pending_exception (mono_get_exception_synchronization_lock ("Not locked"));
return;
}
if (mon_status_get_owner (mon->status) != mono_thread_info_get_small_id ()) {
- mono_raise_exception (mono_get_exception_synchronization_lock ("Not locked by this thread"));
+ mono_set_pending_exception (mono_get_exception_synchronization_lock ("Not locked by this thread"));
return;
}
LockWord lw;
lw.sync = mon;
if (lw.lock_word & LOCK_WORD_THIN_HASH) {
- mono_raise_exception (mono_get_exception_synchronization_lock ("Not locked"));
+ mono_set_pending_exception (mono_get_exception_synchronization_lock ("Not locked"));
return;
}
lw.lock_word &= ~LOCK_WORD_BITS_MASK;
}
#endif
if (mon == NULL) {
- mono_raise_exception (mono_get_exception_synchronization_lock ("Not locked"));
+ mono_set_pending_exception (mono_get_exception_synchronization_lock ("Not locked"));
return;
}
if (mon_status_get_owner (mon->status) != mono_thread_info_get_small_id ()) {
- mono_raise_exception (mono_get_exception_synchronization_lock ("Not locked by this thread"));
+ mono_set_pending_exception (mono_get_exception_synchronization_lock ("Not locked by this thread"));
return;
}
LockWord lw;
lw.sync = mon;
if (lw.lock_word & LOCK_WORD_THIN_HASH) {
- mono_raise_exception (mono_get_exception_synchronization_lock ("Not locked"));
+ mono_set_pending_exception (mono_get_exception_synchronization_lock ("Not locked"));
return FALSE;
}
lw.lock_word &= ~LOCK_WORD_BITS_MASK;
}
#endif
if (mon == NULL) {
- mono_raise_exception (mono_get_exception_synchronization_lock ("Not locked"));
+ mono_set_pending_exception (mono_get_exception_synchronization_lock ("Not locked"));
return FALSE;
}
if (mon_status_get_owner (mon->status) != mono_thread_info_get_small_id ()) {
- mono_raise_exception (mono_get_exception_synchronization_lock ("Not locked by this thread"));
+ mono_set_pending_exception (mono_get_exception_synchronization_lock ("Not locked by this thread"));
return FALSE;
}
event = CreateEvent (NULL, FALSE, FALSE, NULL);
if (event == NULL) {
- mono_raise_exception (mono_get_exception_synchronization_lock ("Failed to set up wait event"));
+ mono_set_pending_exception (mono_get_exception_synchronization_lock ("Failed to set up wait event"));
return FALSE;
}
* is private to this thread. Therefore even if the event was
* signalled before we wait, we still succeed.
*/
+ MONO_PREPARE_BLOCKING
ret = WaitForSingleObjectEx (event, ms, TRUE);
+ MONO_FINISH_BLOCKING
/* Reset the thread state fairly early, so we don't have to worry
* about the monitor error checking
* SynchronizationLockException
*/
CloseHandle (event);
- mono_raise_exception (mono_get_exception_synchronization_lock ("Failed to regain lock"));
+ mono_set_pending_exception (mono_get_exception_synchronization_lock ("Failed to regain lock"));
return FALSE;
}