3 #include <mono/utils/mono-threads.h>
4 #include <mono/utils/mono-mmap.h>
6 #if defined (USE_WASM_BACKEND)
8 #define round_down(addr, val) ((void*)((addr) & ~((val) - 1)))
11 mono_threads_get_max_stack_size (void)
13 return 65536 * 8; //totally arbitrary, this value is actually useless until WASM supports multiple threads.
18 mono_threads_suspend_init_signals (void)
23 mono_threads_suspend_init (void)
28 mono_threads_suspend_register (MonoThreadInfo *info)
33 mono_threads_suspend_begin_async_resume (MonoThreadInfo *info)
39 mono_threads_suspend_free (MonoThreadInfo *info)
44 mono_threads_suspend_begin_async_suspend (MonoThreadInfo *info, gboolean interrupt_kernel)
50 mono_threads_suspend_check_suspend_result (MonoThreadInfo *info)
56 mono_threads_suspend_abort_syscall (MonoThreadInfo *info)
63 mono_native_thread_id_equals (MonoNativeThreadId id1, MonoNativeThreadId id2)
70 mono_native_thread_id_get (void)
72 return (MonoNativeThreadId)1;
76 mono_native_thread_create (MonoNativeThreadId *tid, gpointer func, gpointer arg)
78 g_error ("WASM doesn't support threading");
81 static const char *thread_name;
84 mono_native_thread_set_name (MonoNativeThreadId tid, const char *name)
86 thread_name = g_strdup (name);
90 mono_native_thread_join (MonoNativeThreadId tid)
92 g_error ("WASM doesn't support threading");
99 mono_threads_platform_yield (void)
105 mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize)
107 *staddr = round_down ((size_t)&staddr, 65536); //WASM pagesize is 64k
108 *stsize = 65536 * 4; //we say it's 4 pages, there isn't much that uses this beyond the GC
113 mono_thread_platform_create_thread (MonoThreadStart thread_fn, gpointer thread_data, gsize* const stack_size, MonoNativeThreadId *tid)
115 g_error ("WASM doesn't support threading");
119 void mono_threads_platform_init (void)
124 mono_threads_platform_exit (gsize exit_code)
126 g_error ("WASM doesn't support threading");
130 mono_threads_platform_in_critical_region (MonoNativeThreadId tid)