Update sdks/wasm/framework/src/WebAssembly.Bindings/Core/Array.cs
[mono-project.git] / mono / utils / mono-threads-linux.c
blobe73b86084fc2b9830eb8775db3ee65f5fce376af
1 /**
2 * \file
3 */
5 #include <config.h>
7 #if (defined(__linux__) && !defined(HOST_ANDROID)) || defined(__FreeBSD_kernel__)
9 #include <mono/utils/mono-threads.h>
10 #include <pthread.h>
12 void
13 mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize)
15 pthread_attr_t attr;
16 gint res;
18 *staddr = NULL;
19 *stsize = (size_t)-1;
21 res = pthread_attr_init (&attr);
22 if (G_UNLIKELY (res != 0))
23 g_error ("%s: pthread_attr_init failed with \"%s\" (%d)", __func__, g_strerror (res), res);
25 res = pthread_getattr_np (pthread_self (), &attr);
26 if (G_UNLIKELY (res != 0))
27 g_error ("%s: pthread_getattr_np failed with \"%s\" (%d)", __func__, g_strerror (res), res);
29 res = pthread_attr_getstack (&attr, (void**)staddr, stsize);
30 if (G_UNLIKELY (res != 0))
31 g_error ("%s: pthread_attr_getstack failed with \"%s\" (%d)", __func__, g_strerror (res), res);
33 res = pthread_attr_destroy (&attr);
34 if (G_UNLIKELY (res != 0))
35 g_error ("%s: pthread_attr_destroy failed with \"%s\" (%d)", __func__, g_strerror (res), res);
39 #endif