[threads] Add mono_thread_info_usleep function
[mono.git] / mono / utils / mono-threads.c
index fa5037625f09a6653d609b1889c0851bca2f6a73..9a41de7c7164341b455b9cb1258c06b917840531 100644 (file)
@@ -910,7 +910,7 @@ suspend_sync_nolock (MonoNativeThreadId id, gboolean interrupt_kernel)
                if (sleep_duration == 0)
                        mono_thread_info_yield ();
                else
-                       g_usleep (sleep_duration);
+                       mono_thread_info_usleep (sleep_duration);
 
                sleep_duration += 10;
        }
@@ -1236,6 +1236,15 @@ mono_thread_info_sleep (guint32 ms, gboolean *alerted)
        return 0;
 }
 
+gint
+mono_thread_info_usleep (guint64 us)
+{
+       MONO_PREPARE_BLOCKING;
+       g_usleep (us);
+       MONO_FINISH_BLOCKING;
+       return 0;
+}
+
 gpointer
 mono_thread_info_tls_get (THREAD_INFO_TYPE *info, MonoTlsKey key)
 {