*/
mono_threads_join_threads ();
- mono_error_init (error);
+ error_init (error);
mono_threads_lock ();
if (shutting_down) {
MonoInternalThread *internal;
gboolean res;
- mono_error_init (error);
+ error_init (error);
internal = create_internal_thread_object ();
MonoError error;
MonoString* str;
- mono_error_init (&error);
+ error_init (&error);
LOCK_THREAD (this_obj);
{
LOCK_THREAD (this_obj);
- mono_error_init (error);
+ error_init (error);
if (reset) {
this_obj->flags &= ~MONO_THREAD_FLAG_NAME_SET;
{
MonoArray *copy;
- mono_error_init (error);
+ error_init (error);
if (!arr)
return NULL;
gint32 diff_ms;
gint32 wait = ms;
- mono_error_init (error);
+ error_init (error);
start = (ms == -1) ? 0 : mono_msec_ticks ();
for (;;) {
gint32 diff_ms;
gint32 wait = ms;
- mono_error_init (error);
+ error_init (error);
start = (ms == -1) ? 0 : mono_100ns_ticks ();
do {
return found;
}
-static gboolean
-request_thread_stop (MonoInternalThread *thread)
+void
+mono_thread_stop (MonoThread *thread)
{
- LOCK_THREAD (thread);
+ MonoInternalThread *internal = thread->internal_thread;
- if ((thread->state & ThreadState_StopRequested) != 0 ||
- (thread->state & ThreadState_Stopped) != 0)
+ LOCK_THREAD (internal);
+
+ if (internal->state & (ThreadState_StopRequested | ThreadState_Stopped))
{
- UNLOCK_THREAD (thread);
- return FALSE;
+ UNLOCK_THREAD (internal);
+ return;
}
-
- /* Make sure the thread is awake */
- mono_thread_resume (thread);
- thread->state |= ThreadState_StopRequested;
- thread->state &= ~ThreadState_AbortRequested;
-
- UNLOCK_THREAD (thread);
- return TRUE;
-}
+ /* Make sure the internal is awake */
+ mono_thread_resume (internal);
-/**
- * mono_thread_internal_stop:
- *
- * Request thread @thread to stop.
- *
- * @thread MUST NOT be the current thread.
- */
-void
-mono_thread_internal_stop (MonoInternalThread *thread)
-{
- g_assert (thread != mono_thread_internal_current ());
-
- if (!request_thread_stop (thread))
- return;
-
- async_abort_internal (thread, TRUE);
-}
+ internal->state |= ThreadState_StopRequested;
+ internal->state &= ~ThreadState_AbortRequested;
-void mono_thread_stop (MonoThread *thread)
-{
- MonoInternalThread *internal = thread->internal_thread;
+ UNLOCK_THREAD (internal);
- if (!request_thread_stop (internal))
- return;
-
if (internal == mono_thread_internal_current ()) {
MonoError error;
self_abort_internal (&error);
MonoDebugSourceLocation *location;
int tindex, nthreads;
- mono_error_init (error);
+ error_init (error);
*out_threads = NULL;
*out_stack_frames = NULL;
if (mono_get_eh_callbacks ()->mono_install_handler_block_guard (mono_thread_info_get_suspend_state (info)))
return MonoResumeThread;
- /*
- The target thread is running at least one protected block, which must not be interrupted, so we give up.
- The protected block code will give them a chance when appropriate.
- */
- if (mono_thread_get_abort_prot_block_count (thread) > 0)
- return MonoResumeThread;
-
/*someone is already interrupting it*/
if (!mono_thread_set_interruption_requested (thread))
return MonoResumeThread;
{
MonoException *exc;
- mono_error_init (error);
+ error_init (error);
/* FIXME this is insanely broken, it doesn't cause interruption to happen synchronously
* since passing FALSE to mono_thread_request_interruption makes sure it returns NULL */