[xbuild] Fix bug #674630.
[mono.git] / mono / utils / mach-support.c
1 /*
2  * mach-support-x86.c: mach support for x86
3  *
4  * Authors:
5  *   Geoff Norton (gnorton@novell.com)
6  *
7  * (C) 2010 Ximian, Inc.
8  */
9
10 #include <config.h>
11 #if defined(__MACH__)
12 #include <glib.h>
13 #include <mach/mach.h>
14 #include <mach/task.h>
15 #include <mach/mach_port.h>
16 #include <mach/thread_act.h>
17 #include <mach/thread_status.h>
18
19 #include <mono/arch/x86/x86-codegen.h>
20 #include <mono/metadata/appdomain.h>
21 #include <mono/metadata/debug-helpers.h>
22 #include <mono/metadata/mono-debug.h>
23 #include <mono/utils/mono-mmap.h>
24
25 #include "mach-support.h"
26
27 kern_return_t
28 mono_mach_get_threads (thread_act_array_t *threads, guint32 *count)
29 {
30         kern_return_t ret;
31
32         do {
33                 ret = task_threads (current_task (), threads, count);
34         } while (ret != KERN_SUCCESS);
35
36         return ret;
37 }
38
39 kern_return_t
40 mono_mach_free_threads (thread_act_array_t threads, guint32 count)
41 {
42         return vm_deallocate(current_task (), (vm_address_t) threads, sizeof (thread_t) * count);
43 }
44 #endif