#endif
}
-static void
+static gboolean
mono_monitor_ensure_owned (LockWord lw, guint32 id)
{
if (lock_word_is_flat (lw)) {
if (lock_word_get_owner (lw) == id)
- return;
+ return TRUE;
} else if (lock_word_is_inflated (lw)) {
if (mon_status_get_owner (lock_word_get_inflated_lock (lw)->status) == id)
- return;
+ return TRUE;
}
mono_set_pending_exception (mono_get_exception_synchronization_lock ("Object synchronization method was called from an unsynchronized block of code."));
+ return FALSE;
}
/*
lw.sync = obj->synchronisation;
- mono_monitor_ensure_owned (lw, mono_thread_info_get_small_id ());
+ if (!mono_monitor_ensure_owned (lw, mono_thread_info_get_small_id ()))
+ return;
if (G_UNLIKELY (lock_word_is_inflated (lw)))
mono_monitor_exit_inflated (obj);
id = mono_thread_info_get_small_id ();
lw.sync = obj->synchronisation;
- mono_monitor_ensure_owned (lw, id);
+ if (!mono_monitor_ensure_owned (lw, id))
+ return;
if (!lock_word_is_inflated (lw)) {
/* No threads waiting. A wait would have inflated the lock */
id = mono_thread_info_get_small_id ();
lw.sync = obj->synchronisation;
- mono_monitor_ensure_owned (lw, id);
+ if (!mono_monitor_ensure_owned (lw, id))
+ return;
if (!lock_word_is_inflated (lw)) {
/* No threads waiting. A wait would have inflated the lock */
lw.sync = obj->synchronisation;
- mono_monitor_ensure_owned (lw, id);
+ if (!mono_monitor_ensure_owned (lw, id))
+ return FALSE;
if (!lock_word_is_inflated (lw)) {
mono_monitor_inflate_owned (obj, id);