{
LOCK_THREAD (thread);
- if ((thread->state & ThreadState_AbortRequested) != 0 ||
- (thread->state & ThreadState_StopRequested) != 0 ||
- (thread->state & ThreadState_Stopped) != 0)
+ if (thread->state & (ThreadState_AbortRequested | ThreadState_Stopped))
{
UNLOCK_THREAD (thread);
return FALSE;
{
LOCK_THREAD (thread);
- if ((thread->state & ThreadState_Unstarted) != 0 ||
- (thread->state & ThreadState_Aborted) != 0 ||
- (thread->state & ThreadState_Stopped) != 0)
+ if (thread->state & (ThreadState_Unstarted | ThreadState_Aborted | ThreadState_Stopped))
{
UNLOCK_THREAD (thread);
return FALSE;
}
- if ((thread->state & ThreadState_Suspended) != 0 ||
- (thread->state & ThreadState_SuspendRequested) != 0 ||
- (thread->state & ThreadState_StopRequested) != 0)
+ if (thread->state & (ThreadState_Suspended | ThreadState_SuspendRequested | ThreadState_AbortRequested))
{
UNLOCK_THREAD (thread);
return TRUE;
{
MonoInternalThread *internal = thread->internal_thread;
- LOCK_THREAD (internal);
-
- if (internal->state & (ThreadState_StopRequested | ThreadState_Stopped))
- {
- UNLOCK_THREAD (internal);
+ if (!request_thread_abort (internal, NULL))
return;
- }
-
- /* Make sure the internal is awake */
- mono_thread_resume (internal);
-
- internal->state |= ThreadState_StopRequested;
- internal->state &= ~ThreadState_AbortRequested;
-
- UNLOCK_THREAD (internal);
if (internal == mono_thread_internal_current ()) {
MonoError error;
LOCK_THREAD (current_thread);
- if ((current_thread->state & ThreadState_SuspendRequested) ||
- (current_thread->state & ThreadState_AbortRequested) ||
- (current_thread->state & ThreadState_StopRequested)) {
+ if (current_thread->state & (ThreadState_SuspendRequested | ThreadState_AbortRequested)) {
UNLOCK_THREAD (current_thread);
mono_thread_execute_interruption ();
} else {
- current_thread->state |= ThreadState_Stopped;
UNLOCK_THREAD (current_thread);
}
LOCK_THREAD (thread);
- if ((thread->state & ThreadState_Suspended) != 0 ||
- (thread->state & ThreadState_StopRequested) != 0 ||
- (thread->state & ThreadState_Stopped) != 0) {
+ if (thread->state & (ThreadState_Suspended | ThreadState_Stopped)) {
UNLOCK_THREAD (thread);
mono_threads_close_thread_handle (wait->handles [i]);
wait->threads [i] = NULL;
UNLOCK_THREAD (thread);
return exc;
- } else if ((thread->state & ThreadState_AbortRequested) != 0) {
+ } else if (thread->state & (ThreadState_AbortRequested)) {
UNLOCK_THREAD (thread);
g_assert (sys_thread->pending_exception == NULL);
if (thread->abort_exc == NULL) {
MONO_OBJECT_SETREF (thread, abort_exc, mono_get_exception_thread_abort ());
}
return thread->abort_exc;
- }
- else if ((thread->state & ThreadState_SuspendRequested) != 0) {
+ } else if (thread->state & (ThreadState_SuspendRequested)) {
/* calls UNLOCK_THREAD (thread) */
self_suspend_internal ();
return NULL;
- }
- else if ((thread->state & ThreadState_StopRequested) != 0) {
- /* FIXME: do this through the JIT? */
-
- UNLOCK_THREAD (thread);
-
- mono_thread_exit ();
- return NULL;
} else if (thread->thread_interrupt_requested) {
thread->thread_interrupt_requested = FALSE;
if (thread == NULL)
return NULL;
-#ifdef HOST_WIN32
- if (thread->interrupt_on_stop &&
- thread->state & ThreadState_StopRequested &&
- thread->state & ThreadState_Background)
- ExitThread (1);
-#endif
if (!mono_thread_set_interruption_requested (thread))
return NULL;
InterlockedIncrement (&thread_interruption_requested);
return NULL;
LOCK_THREAD (thread);
- still_aborting = (thread->state & (ThreadState_AbortRequested|ThreadState_StopRequested)) != 0;
+ still_aborting = (thread->state & (ThreadState_AbortRequested)) != 0;
UNLOCK_THREAD (thread);
/*This can happen if the protected block called Thread::ResetAbort*/
#endif
}
-void
-mono_thread_internal_check_for_interruption_critical (MonoInternalThread *thread)
-{
- if ((thread->state & (ThreadState_StopRequested | ThreadState_SuspendRequested)) != 0)
- mono_thread_interruption_checkpoint ();
-}
-
void
mono_thread_internal_unhandled_exception (MonoObject* exc)
{
thread = mono_thread_internal_current ();
LOCK_THREAD (thread);
- if (thread->state & (MonoThreadState)(ThreadState_StopRequested | ThreadState_SuspendRequested | ThreadState_AbortRequested)) {
+ if (thread->state & (ThreadState_SuspendRequested | ThreadState_AbortRequested)) {
UNLOCK_THREAD (thread);
return FALSE;
}