[mono-threads] Assert that we do not try to signal the handle multiple times
[mono.git] / mono / utils / mach-support.c
index 8e3984e3b294f2b1f2f9efe82a096807bf3bddca..314b30d972c2b18c065f33f6978a050b64bb10f0 100644 (file)
 #include <mach/thread_act.h>
 #include <mach/thread_status.h>
 
-#include <mono/arch/x86/x86-codegen.h>
-#include <mono/metadata/appdomain.h>
-#include <mono/metadata/debug-helpers.h>
-#include <mono/metadata/mono-debug.h>
 #include <mono/utils/mono-mmap.h>
 
 #include "mach-support.h"
@@ -31,8 +27,14 @@ mono_mach_get_threads (thread_act_array_t *threads, guint32 *count)
 
        do {
                ret = task_threads (current_task (), threads, count);
-       } while (ret != KERN_SUCCESS);
+       } while (ret == KERN_ABORTED);
 
        return ret;
 }
+
+kern_return_t
+mono_mach_free_threads (thread_act_array_t threads, guint32 count)
+{
+       return vm_deallocate(current_task (), (vm_address_t) threads, sizeof (thread_t) * count);
+}
 #endif