3 * Runtime support for managed Semaphore 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.
11 #include "w32semaphore.h"
15 #include "object-internals.h"
16 #include "icall-decl.h"
19 mono_w32semaphore_init (void)
23 #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT)
25 ves_icall_System_Threading_Semaphore_CreateSemaphore_icall (gint32 initialCount
, gint32 maximumCount
,
26 const gunichar2
*name
, gint32 name_length
, gint32
*win32error
, MonoError
*error
)
30 sem
= CreateSemaphoreW (NULL
, initialCount
, maximumCount
, name
);
32 *win32error
= GetLastError ();
35 #endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT) */
38 ves_icall_System_Threading_Semaphore_ReleaseSemaphore_internal (gpointer handle
, gint32 releaseCount
, gint32
*prevcount
, MonoError
*error
)
40 return ReleaseSemaphore (handle
, releaseCount
, (PLONG
)prevcount
);
44 ves_icall_System_Threading_Semaphore_OpenSemaphore_icall (const gunichar2
*name
, gint32 name_length
,
45 gint32 rights
, gint32
*win32error
, MonoError
*error
)
49 sem
= OpenSemaphoreW (rights
, FALSE
, name
);
51 *win32error
= GetLastError ();