#include <mono/utils/mono-time.h>
#include <mono/utils/atomic.h>
#include <mono/utils/w32api.h>
+#include <mono/utils/mono-os-wait.h>
/*
* Pull the list of opcodes
mon->data = monitor_freelist;
monitor_freelist = mon;
#ifndef DISABLE_PERFCOUNTERS
- mono_perfcounters->gc_sync_blocks--;
+ InterlockedDecrement (&mono_perfcounters->gc_sync_blocks);
#endif
}
new_->data = NULL;
#ifndef DISABLE_PERFCOUNTERS
- mono_perfcounters->gc_sync_blocks++;
+ InterlockedIncrement (&mono_perfcounters->gc_sync_blocks);
#endif
return new_;
}
/* The object must be locked by someone else... */
#ifndef DISABLE_PERFCOUNTERS
- mono_perfcounters->thread_contentions++;
+ InterlockedIncrement (&mono_perfcounters->thread_contentions);
#endif
/* If ms is 0 we don't block, but just fail straight away */
return 0;
}
- mono_profiler_monitor_event (obj, MONO_PROFILER_MONITOR_CONTENTION);
+ MONO_PROFILER_RAISE (monitor_contention, (obj));
/* The slow path begins here. */
retry_contended:
if (G_LIKELY (tmp_status == old_status)) {
/* Success */
g_assert (mon->nest == 1);
- mono_profiler_monitor_event (obj, MONO_PROFILER_MONITOR_DONE);
+ MONO_PROFILER_RAISE (monitor_acquired, (obj));
return 1;
}
}
/* If the object is currently locked by this thread... */
if (mon_status_get_owner (old_status) == id) {
mon->nest++;
- mono_profiler_monitor_event (obj, MONO_PROFILER_MONITOR_DONE);
+ MONO_PROFILER_RAISE (monitor_acquired, (obj));
return 1;
}
waitms = ms;
#ifndef DISABLE_PERFCOUNTERS
- mono_perfcounters->thread_queue_len++;
- mono_perfcounters->thread_queue_max++;
+ InterlockedIncrement (&mono_perfcounters->thread_queue_len);
+ InterlockedIncrement (&mono_perfcounters->thread_queue_max);
#endif
thread = mono_thread_internal_current ();
done_waiting:
#ifndef DISABLE_PERFCOUNTERS
- mono_perfcounters->thread_queue_len--;
+ InterlockedDecrement (&mono_perfcounters->thread_queue_len);
#endif
if (wait_ret == MONO_SEM_TIMEDWAIT_RET_ALERTED && !allow_interruption) {
/* Timed out or interrupted */
mon_decrement_entry_count (mon);
- mono_profiler_monitor_event (obj, MONO_PROFILER_MONITOR_FAIL);
+ MONO_PROFILER_RAISE (monitor_failed, (obj));
if (wait_ret == MONO_SEM_TIMEDWAIT_RET_ALERTED) {
LOCK_DEBUG (g_message ("%s: (%d) interrupted waiting, returning -1", __func__, id));
*/
MONO_ENTER_GC_SAFE;
#ifdef HOST_WIN32
- ret = mono_w32handle_convert_wait_ret (WaitForSingleObjectEx (event, ms, TRUE), 1);
+ ret = mono_w32handle_convert_wait_ret (mono_win32_wait_for_single_object_ex (event, ms, TRUE), 1);
#else
ret = mono_w32handle_wait_one (event, ms, TRUE);
#endif /* HOST_WIN32 */
*/
MONO_ENTER_GC_SAFE;
#ifdef HOST_WIN32
- ret = mono_w32handle_convert_wait_ret (WaitForSingleObjectEx (event, 0, FALSE), 1);
+ ret = mono_w32handle_convert_wait_ret (mono_win32_wait_for_single_object_ex (event, 0, FALSE), 1);
#else
ret = mono_w32handle_wait_one (event, 0, FALSE);
#endif /* HOST_WIN32 */