}
}
- if (ms != INFINITE) {
+ if (ms != MONO_INFINITE_WAIT) {
then = mono_msec_ticks ();
}
waitms = ms;
* allow_interruption is FALSE to avoid hangs at shutdown.
*/
if (!mono_thread_test_state (mono_thread_internal_current (), (MonoThreadState)(ThreadState_StopRequested | ThreadState_SuspendRequested | ThreadState_AbortRequested))) {
- if (ms != INFINITE) {
+ if (ms != MONO_INFINITE_WAIT) {
now = mono_msec_ticks ();
/* it should not overflow before ~30k years */
* it will return NULL meaning we can't be aborted right now. Once that happens we switch to non-alertable.
*/
do {
- res = mono_monitor_try_enter_internal (obj, INFINITE, allow_interruption);
+ res = mono_monitor_try_enter_internal (obj, MONO_INFINITE_WAIT, allow_interruption);
/*This means we got interrupted during the wait and didn't got the monitor.*/
if (res == -1) {
MonoException *exc = mono_thread_interruption_checkpoint ();
return;
}
- ves_icall_System_Threading_Monitor_Monitor_try_enter_with_atomic_var (obj, INFINITE, lock_taken);
+ ves_icall_System_Threading_Monitor_Monitor_try_enter_with_atomic_var (obj, MONO_INFINITE_WAIT, lock_taken);
}
/*
MonoThreadsSync *mon;
HANDLE event;
guint32 nest;
- guint32 ret;
+ MonoW32HandleWaitRet ret;
gboolean success = FALSE;
gint32 regain;
MonoInternalThread *thread = mono_thread_internal_current ();
* signalled before we wait, we still succeed.
*/
MONO_ENTER_GC_SAFE;
- ret = WaitForSingleObjectEx (event, ms, TRUE);
+#ifdef HOST_WIN32
+ ret = mono_w32handle_convert_wait_ret (WaitForSingleObjectEx (event, ms, TRUE), 1);
+#else
+ ret = mono_w32handle_wait_one (event, ms, TRUE);
+#endif /* HOST_WIN32 */
MONO_EXIT_GC_SAFE;
/* Reset the thread state fairly early, so we don't have to worry
/* Regain the lock with the previous nest count */
do {
- regain = mono_monitor_try_enter_inflated (obj, INFINITE, TRUE, id);
+ regain = mono_monitor_try_enter_inflated (obj, MONO_INFINITE_WAIT, TRUE, id);
/* We must regain the lock before handling interruption requests */
} while (regain == -1);
LOCK_DEBUG (g_message ("%s: (%d) Regained %p lock %p", __func__, mono_thread_info_get_small_id (), obj, mon));
- if (ret == WAIT_TIMEOUT) {
+ if (ret == MONO_W32HANDLE_WAIT_RET_TIMEOUT) {
/* Poll the event again, just in case it was signalled
* while we were trying to regain the monitor lock
*/
MONO_ENTER_GC_SAFE;
- ret = WaitForSingleObjectEx (event, 0, FALSE);
+#ifdef HOST_WIN32
+ ret = mono_w32handle_convert_wait_ret (WaitForSingleObjectEx (event, 0, FALSE), 1);
+#else
+ ret = mono_w32handle_wait_one (event, 0, FALSE);
+#endif /* HOST_WIN32 */
MONO_EXIT_GC_SAFE;
}
* thread.
*/
- if (ret == WAIT_OBJECT_0) {
+ if (ret == MONO_W32HANDLE_WAIT_RET_SUCCESS_0) {
LOCK_DEBUG (g_message ("%s: (%d) Success", __func__, mono_thread_info_get_small_id ()));
success = TRUE;
} else {