#include <mono/utils/atomic.h>
#include <mono/utils/mono-memory-model.h>
#include <mono/utils/mono-threads.h>
+#include <mono/utils/w32handle.h>
#ifdef HOST_WIN32
#include <direct.h>
#endif
* Changes which are already detected at runtime, like the addition
* of icalls, do not require an increment.
*/
-#define MONO_CORLIB_VERSION 149
+#define MONO_CORLIB_VERSION 152
typedef struct
{
{
MonoError error;
MonoAppDomain *ad = NULL;
+
#ifdef DISABLE_APPDOMAINS
+ mono_error_init (&error);
mono_error_set_not_supported (&error, "AppDomain creation is not supported on this runtime.");
#else
char *fname;
return location;
}
-static gboolean
-ensure_directory_exists (const char *filename)
-{
-#ifdef HOST_WIN32
- gchar *dir_utf8 = g_path_get_dirname (filename);
- gunichar2 *p;
- gunichar2 *dir_utf16 = NULL;
- int retval;
-
- if (!dir_utf8 || !dir_utf8 [0])
- return FALSE;
-
- dir_utf16 = g_utf8_to_utf16 (dir_utf8, strlen (dir_utf8), NULL, NULL, NULL);
- g_free (dir_utf8);
-
- if (!dir_utf16)
- return FALSE;
-
- p = dir_utf16;
-
- /* make life easy and only use one directory seperator */
- while (*p != '\0')
- {
- if (*p == '/')
- *p = '\\';
- p++;
- }
-
- p = dir_utf16;
-
- /* get past C:\ )*/
- while (*p++ != '\\')
- {
- }
-
- while (1) {
- BOOL bRet = FALSE;
- p = wcschr (p, '\\');
- if (p)
- *p = '\0';
- retval = _wmkdir (dir_utf16);
- if (retval != 0 && errno != EEXIST) {
- g_free (dir_utf16);
- return FALSE;
- }
- if (!p)
- break;
- *p++ = '\\';
- }
-
- g_free (dir_utf16);
- return TRUE;
-#else
- char *p;
- gchar *dir = g_path_get_dirname (filename);
- int retval;
- struct stat sbuf;
-
- if (!dir || !dir [0]) {
- g_free (dir);
- return FALSE;
- }
-
- if (stat (dir, &sbuf) == 0 && S_ISDIR (sbuf.st_mode)) {
- g_free (dir);
- return TRUE;
- }
-
- p = dir;
- while (*p == '/')
- p++;
-
- while (1) {
- p = strchr (p, '/');
- if (p)
- *p = '\0';
- retval = mkdir (dir, 0777);
- if (retval != 0 && errno != EEXIST) {
- g_free (dir);
- return FALSE;
- }
- if (!p)
- break;
- *p++ = '/';
- }
-
- g_free (dir);
- return TRUE;
-#endif
-}
-
static gboolean
private_file_needs_copying (const char *src, struct stat *sbuf_src, char *dest)
{
return NULL;
}
- if (ensure_directory_exists (shadow) == FALSE) {
+ if (g_ensure_directory_exists (shadow) == FALSE) {
g_free (shadow);
mono_error_set_execution_engine (oerror, "Failed to create shadow copy (ensure directory exists).");
return NULL;
sibling_target_len = strlen (sibling_target);
copy_result = shadow_copy_sibling (sibling_source, sibling_source_len, ".mdb", sibling_target, sibling_target_len, 7);
- if (copy_result == TRUE)
+ if (copy_result)
copy_result = shadow_copy_sibling (sibling_source, sibling_source_len, ".config", sibling_target, sibling_target_len, 7);
g_free (sibling_source);
g_free (sibling_target);
- if (copy_result == FALSE) {
+ if (!copy_result) {
g_free (shadow);
mono_error_set_execution_engine (oerror, "Failed to create shadow copy of sibling data (CopyFile).");
return NULL;
mono_error_assert_ok (&error);
}
- return mono_runtime_exec_main (method, (MonoArray *)args, NULL);
+ int res = mono_runtime_exec_main_checked (method, (MonoArray *)args, &error);
+ mono_error_set_pending_exception (&error);
+ return res;
}
gint32
mono_domain_assemblies_unlock (domain);
}
-static guint32 WINAPI
+static gsize WINAPI
unload_thread_main (void *arg)
{
MonoError error;
unload_data *thread_data;
MonoNativeThreadId tid;
MonoDomain *caller_domain = mono_domain_get ();
+ MonoThreadParm tp;
/* printf ("UNLOAD STARTING FOR %s (%p) IN THREAD 0x%x.\n", domain->friendly_name, domain, mono_native_thread_id_get ()); */
* First we create a separate thread for unloading, since
* we might have to abort some threads, including the current one.
*/
- thread_handle = mono_threads_create_thread ((LPTHREAD_START_ROUTINE)unload_thread_main, thread_data, 0, CREATE_SUSPENDED, &tid);
+ tp.priority = MONO_THREAD_PRIORITY_NORMAL;
+ tp.stack_size = 0;
+ tp.creation_flags = CREATE_SUSPENDED;
+ thread_handle = mono_threads_create_thread (unload_thread_main, thread_data, &tp, &tid);
if (thread_handle == NULL)
return;
mono_thread_info_resume (tid);