mono_threads_notify_initiator_of_abort (MonoThreadInfo* info)
{
THREADS_SUSPEND_DEBUG ("[INITIATOR-NOTIFY-ABORT] %p\n", mono_thread_info_get_tid (info));
- MONO_SEM_POST (&suspend_semaphore);
InterlockedIncrement (&abort_posts);
+ MONO_SEM_POST (&suspend_semaphore);
}
void
mono_threads_notify_initiator_of_suspend (MonoThreadInfo* info)
{
THREADS_SUSPEND_DEBUG ("[INITIATOR-NOTIFY-SUSPEND] %p\n", mono_thread_info_get_tid (info));
- MONO_SEM_POST (&suspend_semaphore);
InterlockedIncrement (&suspend_posts);
+ MONO_SEM_POST (&suspend_semaphore);
}
void
mono_threads_notify_initiator_of_resume (MonoThreadInfo* info)
{
THREADS_SUSPEND_DEBUG ("[INITIATOR-NOTIFY-RESUME] %p\n", mono_thread_info_get_tid (info));
- MONO_SEM_POST (&suspend_semaphore);
InterlockedIncrement (&resume_posts);
+ MONO_SEM_POST (&suspend_semaphore);
}
static void
mono_threads_begin_global_suspend (void)
{
g_assert (pending_suspends == 0);
- THREADS_SUSPEND_DEBUG ("------ BEGIN GLOBAL OP sp %d rp %d ap %d wd %d po %d\n", suspend_posts, resume_posts,
+ THREADS_SUSPEND_DEBUG ("------ BEGIN GLOBAL OP sp %d rp %d ap %d wd %d po %d (sp + rp + ap == wd) (wd == po)\n", suspend_posts, resume_posts,
abort_posts, waits_done, pending_ops);
+ g_assert ((suspend_posts + resume_posts + abort_posts) == waits_done);
mono_threads_core_begin_global_suspend ();
}
g_assert (pending_suspends == 0);
THREADS_SUSPEND_DEBUG ("------ END GLOBAL OP sp %d rp %d ap %d wd %d po %d\n", suspend_posts, resume_posts,
abort_posts, waits_done, pending_ops);
+ g_assert ((suspend_posts + resume_posts + abort_posts) == waits_done);
mono_threads_core_end_global_suspend ();
}
int c = pending_suspends;
/* Wait threads to park */
+ THREADS_SUSPEND_DEBUG ("[INITIATOR-WAIT-COUNT] %d\n", c);
if (pending_suspends) {
MonoStopwatch suspension_time;
mono_stopwatch_start (&suspension_time);
- THREADS_SUSPEND_DEBUG ("[INITIATOR-WAIT-COUNT] %d\n", c);
for (i = 0; i < pending_suspends; ++i) {
THREADS_SUSPEND_DEBUG ("[INITIATOR-WAIT-WAITING]\n");
InterlockedIncrement (&waits_done);
MonoThreadInfo*
mono_thread_info_current_unchecked (void)
{
- return (MonoThreadInfo*)mono_native_tls_get_value (thread_info_key);
+ return mono_threads_inited ? (MonoThreadInfo*)mono_native_tls_get_value (thread_info_key) : NULL;
}
res = mono_native_tls_alloc (&thread_info_key, (void *) unregister_thread);
res = mono_native_tls_alloc (&thread_exited_key, (void *) thread_exited_dtor);
#endif
+
g_assert (res);
#ifndef HAVE_KW_THREAD