Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasm] Throw an exception when trying to start a thread instead of asserting. #34347

Merged
merged 1 commit into from
Apr 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/mono/mono/metadata/threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -1717,6 +1717,11 @@ ves_icall_System_Threading_Thread_Thread_internal (MonoThreadObjectHandle thread
MonoThread *this_obj = MONO_HANDLE_RAW (thread_handle);
MonoObject *start = MONO_HANDLE_RAW (start_handle);

#ifdef DISABLE_THREADS
mono_error_set_not_supported (error, "Cannot start threads on this runtime.");
return FALSE;
#endif

THREAD_DEBUG (g_message("%s: Trying to start a new thread: this (%p) start (%p)", __func__, this_obj, start));

internal = thread_handle_to_internal_ptr (thread_handle);
Expand Down Expand Up @@ -6746,13 +6751,13 @@ ves_icall_System_Threading_Thread_StartInternal (MonoThreadObjectHandle thread_h
MonoThread *internal = MONO_HANDLE_RAW (thread_handle);
gboolean res;

THREAD_DEBUG (g_message("%s: Trying to start a new thread: this (%p)", __func__, internal));

#ifdef DISABLE_THREADS
mono_error_set_not_supported (error, NULL);
mono_error_set_not_supported (error, "Cannot start threads on this runtime.");
return;
#endif

THREAD_DEBUG (g_message("%s: Trying to start a new thread: this (%p)", __func__, internal));

LOCK_THREAD (internal);

if ((internal->state & ThreadState_Unstarted) == 0) {
Expand Down