Merge pull request #1860 from saper/tz-fix
[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 #include <mono/metadata/object-internals.h>
9
10 #define SMALL_STACK (sizeof (gpointer) * 32 * 1024)
11
12 enum {
13         STATUS_NOT_INITIALIZED,
14         STATUS_INITIALIZING,
15         STATUS_INITIALIZED,
16         STATUS_CLEANING_UP,
17         STATUS_CLEANED_UP,
18 };
19
20 typedef struct _MonoNativeOverlapped MonoNativeOverlapped;
21
22 void
23 mono_threadpool_ms_cleanup (void);
24
25 MonoAsyncResult *
26 mono_threadpool_ms_begin_invoke (MonoDomain *domain, MonoObject *target, MonoMethod *method, gpointer *params);
27 MonoObject *
28 mono_threadpool_ms_end_invoke (MonoAsyncResult *ares, MonoArray **out_args, MonoObject **exc);
29
30 gboolean
31 mono_threadpool_ms_remove_domain_jobs (MonoDomain *domain, int timeout);
32
33 void
34 mono_threadpool_ms_suspend (void);
35 void
36 mono_threadpool_ms_resume (void);
37
38 void
39 ves_icall_System_Threading_ThreadPool_GetAvailableThreadsNative (gint32 *worker_threads, gint32 *completion_port_threads);
40 void
41 ves_icall_System_Threading_ThreadPool_GetMinThreadsNative (gint32 *worker_threads, gint32 *completion_port_threads);
42 void
43 ves_icall_System_Threading_ThreadPool_GetMaxThreadsNative (gint32 *worker_threads, gint32 *completion_port_threads);
44 MonoBoolean
45 ves_icall_System_Threading_ThreadPool_SetMinThreadsNative (gint32 worker_threads, gint32 completion_port_threads);
46 MonoBoolean
47 ves_icall_System_Threading_ThreadPool_SetMaxThreadsNative (gint32 worker_threads, gint32 completion_port_threads);
48 void
49 ves_icall_System_Threading_ThreadPool_InitializeVMTp (MonoBoolean *enable_worker_tracking);
50 MonoBoolean
51 ves_icall_System_Threading_ThreadPool_NotifyWorkItemComplete (void);
52 void
53 ves_icall_System_Threading_ThreadPool_NotifyWorkItemProgressNative (void);
54 void
55 ves_icall_System_Threading_ThreadPool_ReportThreadStatus (MonoBoolean is_working);
56 MonoBoolean
57 ves_icall_System_Threading_ThreadPool_RequestWorkerThread (void);
58
59 MonoBoolean
60 ves_icall_System_Threading_ThreadPool_PostQueuedCompletionStatus (MonoNativeOverlapped *native_overlapped);
61
62 MonoBoolean
63 ves_icall_System_Threading_ThreadPool_BindIOCompletionCallbackNative (gpointer file_handle);
64
65 MonoBoolean
66 ves_icall_System_Threading_ThreadPool_IsThreadPoolHosted (void);
67
68 /* Internals */
69
70 void
71 mono_threadpool_ms_enqueue_work_item (MonoDomain *domain, MonoObject *work_item);
72
73 #endif // _MONO_THREADPOOL_MICROSOFT_H_