*lockTaken = res == 1;
}
+void
+mono_monitor_enter_v4 (MonoObject *obj, char *lock_taken)
+{
+ if (*lock_taken == 1)
+ mono_raise_exception (mono_get_exception_argument ("lockTaken", "lockTaken is already true"));
+
+ ves_icall_System_Threading_Monitor_Monitor_try_enter_with_atomic_var (obj, INFINITE, lock_taken);
+}
+
gboolean
ves_icall_System_Threading_Monitor_Monitor_test_owner (MonoObject *obj)
{
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;
}
* 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;
}