More proper detection of reset_priority, make stub for Haiku
authorCalvin <calvin@openmailbox.org>
Wed, 15 Feb 2017 04:25:34 +0000 (00:25 -0400)
committerCalvin <calvin@openmailbox.org>
Mon, 27 Feb 2017 15:27:53 +0000 (11:27 -0400)
mono/utils/mono-threads-haiku.c
mono/utils/mono-threads-posix.c
mono/utils/mono-threads.h

index e5c3563902ab6c79a6107c8a0e8b55e291764a48..231ff3be8f4299e6d13640a00ae10da24f2128d8 100644 (file)
@@ -6,6 +6,12 @@
 #include <pthread.h>
 #include <os/kernel/OS.h>
 
+void
+mono_threads_platform_reset_priority(pthread_attr_t *attr)
+{
+       /* FIXME: Implement this on Haiku */
+}
+
 void
 mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize)
 {
index 846ac4023fd14c9bd2163d97dcc0e787a982f67f..2b48be021d9a2e7112a24b715dd87a5fca9ef2b2 100644 (file)
@@ -35,10 +35,9 @@ extern int tkill (pid_t tid, int signal);
 
 #include <sys/resource.h>
 
-/* FIXME: Haiku lacks pthread_attr_setschedpolicy */
-#if !defined(__HAIKU__)
-static void
-reset_priority (pthread_attr_t *attr)
+#ifdef MONO_THREADS_PLATFORM_HAS_ATTR_SETSCHED
+void
+mono_threads_platform_reset_priority (pthread_attr_t *attr)
 {
        struct sched_param param;
        gint res;
@@ -124,10 +123,7 @@ mono_threads_platform_create_thread (MonoThreadStart thread_fn, gpointer thread_
        g_assert (!res);
 #endif /* HAVE_PTHREAD_ATTR_SETSTACKSIZE */
 
-/* FIXME: Haiku lacks pthread_attr_setschedpolicy */
-#if !defined(__HAIKU__)
-       reset_priority (&attr);
-#endif
+       mono_threads_platform_reset_priority (&attr);
 
        if (stack_size) {
                res = pthread_attr_getstacksize (&attr, &min_stack_size);
index 0e77e3956630a51a293468778eaae83ce4bb900e..344fbdec3c89bda1e4de22e147f47ad8a15810d1 100644 (file)
@@ -62,6 +62,10 @@ typedef gsize mono_thread_start_return_t;
 
 typedef gsize (*MonoThreadStart)(gpointer);
 
+#if !defined(__HAIKU__)
+#define MONO_THREADS_PLATFORM_HAS_ATTR_SETSCHED
+#endif /* !defined(__HAIKU__) */
+
 #endif /* #ifdef HOST_WIN32 */
 
 #ifndef MONO_INFINITE_WAIT
@@ -478,6 +482,9 @@ gint mono_threads_suspend_get_suspend_signal (void);
 gint mono_threads_suspend_get_restart_signal (void);
 gint mono_threads_suspend_get_abort_signal (void);
 
+#if defined(USE_POSIX_BACKEND)
+void mono_threads_platform_reset_priority (pthread_attr_t *attr);
+#endif /* defined(USE_POSIX_BACKEND) */
 int mono_threads_platform_create_thread (MonoThreadStart thread_fn, gpointer thread_data, gsize* const stack_size, MonoNativeThreadId *out_tid);
 void mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize);
 void mono_threads_platform_init (void);