Patch for bug #62532 implemention of a kqueue/kevent based FileSystemWatcher.
[mono.git] / mono / metadata / threads-types.h
1 /*
2  * threads-types.h: Generic thread typedef support (includes
3  * system-specific files)
4  *
5  * Author:
6  *      Dick Porter (dick@ximian.com)
7  *
8  * (C) 2001 Ximian, Inc
9  */
10
11 #ifndef _MONO_METADATA_THREADS_TYPES_H_
12 #define _MONO_METADATA_THREADS_TYPES_H_
13
14 #include <glib.h>
15
16 #include <mono/io-layer/io-layer.h>
17
18 struct _MonoThreadsSync
19 {
20         guint32 owner;                  /* thread ID */
21         guint32 nest;
22         volatile guint32 entry_count;
23         HANDLE entry_sem;
24         GSList *wait_list;
25 };
26
27 /* This is a copy of System.Threading.ThreadState */
28 typedef enum {
29         ThreadState_Running = 0x00000000,
30         ThreadState_StopRequested = 0x00000001,
31         ThreadState_SuspendRequested = 0x00000002,
32         ThreadState_Background = 0x00000004,
33         ThreadState_Unstarted = 0x00000008,
34         ThreadState_Stopped = 0x00000010,
35         ThreadState_WaitSleepJoin = 0x00000020,
36         ThreadState_Suspended = 0x00000040,
37         ThreadState_AbortRequested = 0x00000080,
38         ThreadState_Aborted = 0x00000100
39 } MonoThreadState;
40
41 #define SPECIAL_STATIC_NONE 0
42 #define SPECIAL_STATIC_THREAD 1
43 #define SPECIAL_STATIC_CONTEXT 2
44
45 extern HANDLE ves_icall_System_Threading_Thread_Thread_internal(MonoThread *this_obj, MonoObject *start);
46 extern void ves_icall_System_Threading_Thread_Thread_free_internal(MonoThread *this_obj, HANDLE thread);
47 extern void ves_icall_System_Threading_Thread_Start_internal(MonoThread *this_obj, HANDLE thread);
48 extern void ves_icall_System_Threading_Thread_Sleep_internal(int ms);
49 extern gboolean ves_icall_System_Threading_Thread_Join_internal(MonoThread *this_obj, int ms, HANDLE thread);
50 extern gint32 ves_icall_System_Threading_Thread_GetDomainID (void);
51 extern MonoString* ves_icall_System_Threading_Thread_GetName_internal (MonoThread *this_obj);
52 extern void ves_icall_System_Threading_Thread_SetName_internal (MonoThread *this_obj, MonoString *name);
53 extern void ves_icall_System_Threading_Thread_SlotHash_store(MonoObject *data);
54 extern MonoObject *ves_icall_System_Threading_Thread_SlotHash_lookup(void);
55 extern HANDLE ves_icall_System_Threading_Mutex_CreateMutex_internal(MonoBoolean owned, MonoString *name, MonoBoolean *created);
56 extern void ves_icall_System_Threading_Mutex_ReleaseMutex_internal (HANDLE handle );
57 extern HANDLE ves_icall_System_Threading_Events_CreateEvent_internal (MonoBoolean manual, MonoBoolean initial, MonoString *name);
58 extern gboolean ves_icall_System_Threading_Events_SetEvent_internal (HANDLE handle);
59 extern gboolean ves_icall_System_Threading_Events_ResetEvent_internal (HANDLE handle);
60 extern void ves_icall_System_Threading_Events_CloseEvent_internal (HANDLE handle);
61
62 extern gboolean ves_icall_System_Threading_WaitHandle_WaitAll_internal(MonoArray *mono_handles, gint32 ms, gboolean exitContext);
63 extern gint32 ves_icall_System_Threading_WaitHandle_WaitAny_internal(MonoArray *mono_handles, gint32 ms, gboolean exitContext);
64 extern gboolean ves_icall_System_Threading_WaitHandle_WaitOne_internal(MonoObject *this_obj, HANDLE handle, gint32 ms, gboolean exitContext);
65
66 extern gint32 ves_icall_System_Threading_Interlocked_Increment_Int(gint32 *location);
67 extern gint64 ves_icall_System_Threading_Interlocked_Increment_Long(gint64 *location);
68 extern gint32 ves_icall_System_Threading_Interlocked_Decrement_Int(gint32 *location);
69 extern gint64 ves_icall_System_Threading_Interlocked_Decrement_Long(gint64 * location);
70
71 extern gint32 ves_icall_System_Threading_Interlocked_Exchange_Int(gint32 *location1, gint32 value);
72 extern MonoObject *ves_icall_System_Threading_Interlocked_Exchange_Object(MonoObject **location1, MonoObject *value);
73 extern gfloat ves_icall_System_Threading_Interlocked_Exchange_Single(gfloat *location1, gfloat value);
74
75 extern gint32 ves_icall_System_Threading_Interlocked_CompareExchange_Int(gint32 *location1, gint32 value, gint32 comparand);
76 extern MonoObject *ves_icall_System_Threading_Interlocked_CompareExchange_Object(MonoObject **location1, MonoObject *value, MonoObject *comparand);
77 extern gfloat ves_icall_System_Threading_Interlocked_CompareExchange_Single(gfloat *location1, gfloat value, gfloat comparand);
78 extern void ves_icall_System_Threading_Thread_Abort (MonoThread *thread, MonoObject *state);
79 extern void ves_icall_System_Threading_Thread_ResetAbort (void);
80 extern void ves_icall_System_Threading_Thread_Suspend (MonoThread *thread);
81 extern void ves_icall_System_Threading_Thread_Resume (MonoThread *thread);
82
83 gint8 ves_icall_System_Threading_Thread_VolatileRead1 (void *ptr);
84 gint16 ves_icall_System_Threading_Thread_VolatileRead2 (void *ptr);
85 gint32 ves_icall_System_Threading_Thread_VolatileRead4 (void *ptr);
86 gint64 ves_icall_System_Threading_Thread_VolatileRead8 (void *ptr);
87 void * ves_icall_System_Threading_Thread_VolatileReadIntPtr (void *ptr);
88
89 void ves_icall_System_Threading_Thread_VolatileWrite1 (void *ptr, gint8);
90 void ves_icall_System_Threading_Thread_VolatileWrite2 (void *ptr, gint16);
91 void ves_icall_System_Threading_Thread_VolatileWrite4 (void *ptr, gint32);
92 void ves_icall_System_Threading_Thread_VolatileWrite8 (void *ptr, gint64);
93 void ves_icall_System_Threading_Thread_VolatileWriteIntPtr (void *ptr, void *);
94
95
96 #endif /* _MONO_METADATA_THREADS_TYPES_H_ */