Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin <calvin@openmailbox.org>2017-02-15 07:25:34 +0300
committerCalvin <calvin@openmailbox.org>2017-02-27 18:27:53 +0300
commit8120d7baade9cf49a46e60a6bccf1428680895b7 (patch)
treecdb4b6371d98e546acf4589fd71d8fea09b37661
parent79f69c8cd7048037ecffd40df223fb60f803cbdb (diff)
More proper detection of reset_priority, make stub for Haiku
-rw-r--r--mono/utils/mono-threads-haiku.c6
-rw-r--r--mono/utils/mono-threads-posix.c12
-rw-r--r--mono/utils/mono-threads.h7
3 files changed, 17 insertions, 8 deletions
diff --git a/mono/utils/mono-threads-haiku.c b/mono/utils/mono-threads-haiku.c
index e5c3563902a..231ff3be8f4 100644
--- a/mono/utils/mono-threads-haiku.c
+++ b/mono/utils/mono-threads-haiku.c
@@ -7,6 +7,12 @@
#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)
{
thread_info ti;
diff --git a/mono/utils/mono-threads-posix.c b/mono/utils/mono-threads-posix.c
index 846ac4023fd..2b48be021d9 100644
--- a/mono/utils/mono-threads-posix.c
+++ b/mono/utils/mono-threads-posix.c
@@ -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);
diff --git a/mono/utils/mono-threads.h b/mono/utils/mono-threads.h
index 0e77e395663..344fbdec3c8 100644
--- a/mono/utils/mono-threads.h
+++ b/mono/utils/mono-threads.h
@@ -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);