* Runtime functions
*
* Authors:
- * Jonathan Pryor
+ * Jonathan Pryor
*
* Copyright 2010 Novell, Inc (http://www.novell.com)
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
#include <mono/metadata/threadpool.h>
#include <mono/metadata/marshal.h>
#include <mono/utils/atomic.h>
+#include <mono/utils/unlocked.h>
static gboolean shutting_down_inited = FALSE;
static gboolean shutting_down = FALSE;
-/**
+/**
* mono_runtime_set_shutting_down:
* \deprecated This function can break the shutdown sequence.
*
void
mono_runtime_set_shutting_down (void)
{
- shutting_down = TRUE;
+ UnlockedWriteBool (&shutting_down, TRUE);
}
/**
gboolean
mono_runtime_is_shutting_down (void)
{
- return shutting_down;
+ return UnlockedReadBool (&shutting_down);
}
static void
field = mono_class_get_field_from_name (mono_defaults.appdomain_class, "ProcessExit");
g_assert (field);
- delegate = *(MonoObject **)(((char *)domain->domain) + field->offset);
+ delegate = *(MonoObject **)(((char *)domain->domain) + field->offset);
if (delegate == NULL)
return;
#endif
}
-
/**
* mono_runtime_try_shutdown:
*
mono_runtime_fire_process_exit_event ();
- shutting_down = TRUE;
+ mono_runtime_set_shutting_down ();
mono_threads_set_shutting_down ();
/* No new threads will be created after this point */
- mono_runtime_set_shutting_down ();
-
/*TODO move the follow to here:
mono_thread_suspend_all_other_threads (); OR mono_thread_wait_all_other_threads