3 * Runtime support for managed Event on Win32
6 * Ludovic Henry (luhenry@microsoft.com)
8 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
15 #include <mono/metadata/handle.h>
16 #include <mono/utils/mono-error-internals.h>
19 mono_w32event_init (void)
24 mono_w32event_create (gboolean manual
, gboolean initial
)
26 return CreateEvent (NULL
, manual
, initial
, NULL
);
30 mono_w32event_close (gpointer handle
)
32 return CloseHandle (handle
);
36 mono_w32event_set (gpointer handle
)
42 mono_w32event_reset (gpointer handle
)
48 ves_icall_System_Threading_Events_CreateEvent_internal (MonoBoolean manual
, MonoBoolean initial
, MonoStringHandle name
, gint32
*err
, MonoError
*error
)
54 uint32_t gchandle
= 0;
55 gunichar2
*uniname
= NULL
;
56 if (!MONO_HANDLE_IS_NULL (name
))
57 uniname
= mono_string_handle_pin_chars (name
, &gchandle
);
59 event
= CreateEvent (NULL
, manual
, initial
, uniname
);
60 *err
= GetLastError ();
63 mono_gchandle_free_internal (gchandle
);
69 ves_icall_System_Threading_Events_SetEvent_internal (gpointer handle
)
71 return SetEvent (handle
);
75 ves_icall_System_Threading_Events_ResetEvent_internal (gpointer handle
)
77 return ResetEvent (handle
);
81 ves_icall_System_Threading_Events_CloseEvent_internal (gpointer handle
)
87 ves_icall_System_Threading_Events_OpenEvent_internal (MonoStringHandle name
, gint32 rights
, gint32
*err
, MonoError
*error
)
95 uint32_t gchandle
= 0;
96 gunichar2
*uniname
= NULL
;
98 if (!MONO_HANDLE_IS_NULL (name
))
99 uniname
= mono_string_handle_pin_chars (name
, &gchandle
);
102 handle
= OpenEvent (rights
, FALSE
, uniname
);
104 *err
= GetLastError ();
108 mono_gchandle_free_internal (gchandle
);