[threadpool-ms] Guarantee icall parameter size
[mono.git] / mono / metadata / threadpool-ms.h
1 #ifndef _MONO_THREADPOOL_MICROSOFT_H_
2 #define _MONO_THREADPOOL_MICROSOFT_H_
3
4 #include <config.h>
5 #include <glib.h>
6
7 #include <mono/metadata/exception.h>
8
9 #define SMALL_STACK (sizeof (gpointer) * 32 * 1024)
10
11 enum {
12         STATUS_NOT_INITIALIZED,
13         STATUS_INITIALIZING,
14         STATUS_INITIALIZED,
15         STATUS_CLEANING_UP,
16         STATUS_CLEANED_UP,
17 };
18
19 typedef struct _MonoNativeOverlapped MonoNativeOverlapped;
20
21 static void G_GNUC_UNUSED
22 mono_threadpool_ms_init (void)
23 {
24         /* Initialization is done lazily */
25 }
26
27 static void G_GNUC_UNUSED
28 mono_threadpool_ms_init_tls (void)
29 {
30         /* The WSQ is now implemented in managed */
31 }
32
33 void
34 mono_threadpool_ms_cleanup (void);
35
36 MonoAsyncResult *
37 mono_threadpool_ms_begin_invoke (MonoDomain *domain, MonoObject *target, MonoMethod *method, gpointer *params);
38 MonoObject *
39 mono_threadpool_ms_end_invoke (MonoAsyncResult *ares, MonoArray **out_args, MonoObject **exc);
40
41 gboolean
42 mono_threadpool_ms_remove_domain_jobs (MonoDomain *domain, int timeout);
43
44 void
45 mono_threadpool_ms_suspend (void);
46 void
47 mono_threadpool_ms_resume (void);
48
49 static gboolean G_GNUC_UNUSED
50 mono_threadpool_ms_is_queue_array (MonoArray *arr)
51 {
52         /* The queue is in managed code */
53         return FALSE;
54 }
55
56 void
57 ves_icall_System_Threading_Microsoft_ThreadPool_GetAvailableThreadsNative (gint32 *worker_threads, gint32 *completion_port_threads);
58 void
59 ves_icall_System_Threading_Microsoft_ThreadPool_GetMinThreadsNative (gint32 *worker_threads, gint32 *completion_port_threads);
60 void
61 ves_icall_System_Threading_Microsoft_ThreadPool_GetMaxThreadsNative (gint32 *worker_threads, gint32 *completion_port_threads);
62 MonoBoolean
63 ves_icall_System_Threading_Microsoft_ThreadPool_SetMinThreadsNative (gint32 worker_threads, gint32 completion_port_threads);
64 MonoBoolean
65 ves_icall_System_Threading_Microsoft_ThreadPool_SetMaxThreadsNative (gint32 worker_threads, gint32 completion_port_threads);
66 void
67 ves_icall_System_Threading_Microsoft_ThreadPool_InitializeVMTp (MonoBoolean *enable_worker_tracking);
68 MonoBoolean
69 ves_icall_System_Threading_Microsoft_ThreadPool_NotifyWorkItemComplete (void);
70 void
71 ves_icall_System_Threading_Microsoft_ThreadPool_NotifyWorkItemProgressNative (void);
72 void
73 ves_icall_System_Threading_Microsoft_ThreadPool_ReportThreadStatus (MonoBoolean is_working);
74 MonoBoolean
75 ves_icall_System_Threading_Microsoft_ThreadPool_RequestWorkerThread (void);
76
77 MonoBoolean
78 ves_icall_System_Threading_Microsoft_ThreadPool_PostQueuedCompletionStatus (MonoNativeOverlapped *native_overlapped);
79
80 MonoBoolean
81 ves_icall_System_Threading_Microsoft_ThreadPool_BindIOCompletionCallbackNative (gpointer file_handle);
82
83 MonoBoolean
84 ves_icall_System_Threading_Microsoft_ThreadPool_IsThreadPoolHosted (void);
85
86 /* Internals */
87
88 void
89 mono_threadpool_ms_enqueue_work_item (MonoDomain *domain, MonoObject *work_item);
90
91 #endif // _MONO_THREADPOOL_MICROSOFT_H_