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:
authorVlad Brezae <brezaevlad@gmail.com>2018-10-03 01:00:59 +0300
committerVlad Brezae <brezaevlad@gmail.com>2018-10-03 10:37:23 +0300
commitd050e323ed947e964960938c15c780f795af04ae (patch)
treeed44c32e405b50971307a8b3bc7ad29485b8ee5e
parent6c46acfe697aae35bcc09c25a68bc7b67dad73d8 (diff)
[runtime] Fix undefined pthread_main_np (#10930)
It is exported only when _DARWIN_C_SOURCE is defined.
-rw-r--r--mono/mini/mini-exceptions.c2
-rw-r--r--mono/utils/mono-threads-mach.c5
-rw-r--r--mono/utils/mono-threads.h1
3 files changed, 7 insertions, 1 deletions
diff --git a/mono/mini/mini-exceptions.c b/mono/mini/mini-exceptions.c
index 9316af36f85..dd04c1edbcc 100644
--- a/mono/mini/mini-exceptions.c
+++ b/mono/mini/mini-exceptions.c
@@ -2708,7 +2708,7 @@ mono_setup_altstack (MonoJitTlsData *tls)
* On macOS Mojave we are encountering a bug when changing mapping for main thread
* stack pages. Stack overflow on main thread will kill the app.
*/
- gboolean disable_stack_guard = pthread_main_np ();
+ gboolean disable_stack_guard = mono_threads_platform_is_main_thread ();
#else
gboolean disable_stack_guard = FALSE;
#endif
diff --git a/mono/utils/mono-threads-mach.c b/mono/utils/mono-threads-mach.c
index a9f885b5d3a..1507c97ed86 100644
--- a/mono/utils/mono-threads-mach.c
+++ b/mono/utils/mono-threads-mach.c
@@ -259,4 +259,9 @@ mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize)
*staddr -= *stsize;
}
+gboolean
+mono_threads_platform_is_main_thread (void)
+{
+ return pthread_main_np () == 1;
+}
#endif
diff --git a/mono/utils/mono-threads.h b/mono/utils/mono-threads.h
index 9af75c5b96f..932a8f93645 100644
--- a/mono/utils/mono-threads.h
+++ b/mono/utils/mono-threads.h
@@ -568,6 +568,7 @@ mono_thread_platform_create_thread (MonoThreadStart thread_fn, gpointer thread_d
gsize* const stack_size, MonoNativeThreadId *tid);
void mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize);
+gboolean mono_threads_platform_is_main_thread (void);
void mono_threads_platform_init (void);
gboolean mono_threads_platform_in_critical_region (MonoNativeThreadId tid);
gboolean mono_threads_platform_yield (void);