+2005-06-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * threads.c: avoid segfault when an unstarted thread is aborted.
+
2005-06-05 Kornél Pál <kornelpal@hotmail.com>
* icall.c: Added ves_icall_Mono_Runtime_GetDisplayName:
mono_monitor_enter (this->synch_lock);
- if ((this->state & ThreadState_Unstarted) == 0) {
+ if ((this->state & ThreadState_Unstarted) == 0 ||
+ (this->state & ThreadState_Aborted) != 0) {
mono_monitor_exit (this->synch_lock);
mono_raise_exception (mono_get_exception_thread_state ("Thread has already been started."));
return NULL;
return;
}
+ if ((thread->state & ThreadState_Unstarted) != 0) {
+ thread->state |= ThreadState_Aborted;
+ mono_monitor_exit (thread->synch_lock);
+ return;
+ }
+
thread->state |= ThreadState_AbortRequested;
thread->abort_state = state;
thread->abort_exc = NULL;