[threadpool] Split domain and worker management (#4117)
[mono.git] / mono / mini / debugger-agent.c
index f8aeed4392a79a5d52f54ad24b4b9eedbb9f591c..9b188eeb2af50309ccf07f68ca823d03ce11ad38 100644 (file)
@@ -58,7 +58,7 @@
 #include <mono/metadata/gc-internals.h>
 #include <mono/metadata/environment.h>
 #include <mono/metadata/threads-types.h>
-#include <mono/metadata/threadpool-ms.h>
+#include <mono/metadata/threadpool.h>
 #include <mono/metadata/socket-io.h>
 #include <mono/metadata/assembly.h>
 #include <mono/metadata/runtime.h>
@@ -75,6 +75,7 @@
 #include "debugger-agent.h"
 #include "mini.h"
 #include "seq-points.h"
+#include <mono/io-layer/io-layer.h>
 
 /*
  * On iOS we can't use System.Environment.Exit () as it will do the wrong
@@ -2773,7 +2774,7 @@ suspend_vm (void)
                /*
                 * Suspend creation of new threadpool threads, since they cannot run
                 */
-               mono_threadpool_ms_suspend ();
+               mono_threadpool_suspend ();
 
        mono_loader_unlock ();
 }
@@ -2811,7 +2812,7 @@ resume_vm (void)
        //g_assert (err == 0);
 
        if (suspend_count == 0)
-               mono_threadpool_ms_resume ();
+               mono_threadpool_resume ();
 
        mono_loader_unlock ();
 }
@@ -7741,6 +7742,23 @@ domain_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
        return ERR_NONE;
 }
 
+static ErrorCode
+get_assembly_object_command (MonoDomain *domain, MonoAssembly *ass, Buffer *buf, MonoError *error)
+{
+       HANDLE_FUNCTION_ENTER();
+       ErrorCode err = ERR_NONE;
+       mono_error_init (error);
+       MonoReflectionAssemblyHandle o = mono_assembly_get_object_handle (domain, ass, error);
+       if (MONO_HANDLE_IS_NULL (o)) {
+               err = ERR_INVALID_OBJECT;
+               goto leave;
+       }
+       buffer_add_objid (buf, MONO_HANDLE_RAW (MONO_HANDLE_CAST (MonoObject, o)));
+leave:
+       HANDLE_FUNCTION_RETURN_VAL (err);
+}
+
+
 static ErrorCode
 assembly_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
 {
@@ -7783,13 +7801,9 @@ assembly_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
        }
        case CMD_ASSEMBLY_GET_OBJECT: {
                MonoError error;
-               MonoObject *o = (MonoObject*)mono_assembly_get_object_checked (domain, ass, &error);
-               if (!o) {
-                       mono_error_cleanup (&error); /* FIXME don't swallow the error */
-                       return ERR_INVALID_OBJECT;
-               }
-               buffer_add_objid (buf, o);
-               break;
+               err = get_assembly_object_command (domain, ass, buf, &error);
+               mono_error_cleanup (&error);
+               return err;
        }
        case CMD_ASSEMBLY_GET_TYPE: {
                MonoError error;