NULL, /* is_owned */
};
-static gboolean event_pulse (gpointer handle);
-static gboolean event_reset (gpointer handle);
-static gboolean event_set (gpointer handle);
-
-static gboolean namedevent_pulse (gpointer handle);
-static gboolean namedevent_reset (gpointer handle);
-static gboolean namedevent_set (gpointer handle);
-
-static struct
-{
- gboolean (*pulse)(gpointer handle);
- gboolean (*reset)(gpointer handle);
- gboolean (*set)(gpointer handle);
-} event_ops[WAPI_HANDLE_COUNT] = {
- {NULL},
- {NULL},
- {NULL},
- {NULL},
- {NULL},
- {NULL},
- {event_pulse, event_reset, event_set},
- {NULL},
- {NULL},
- {NULL},
- {NULL},
- {NULL},
- {NULL},
- {namedevent_pulse, namedevent_reset, namedevent_set},
-};
-
void _wapi_event_details (gpointer handle_info)
{
struct _WapiHandle_event *event = (struct _WapiHandle_event *)handle_info;
(WapiHandleCapability)(WAPI_HANDLE_CAP_WAIT | WAPI_HANDLE_CAP_SIGNAL));
}
-static void event_signal(gpointer handle)
+static const char* event_handle_type_to_string (WapiHandleType type)
{
- SetEvent(handle);
+ switch (type) {
+ case WAPI_HANDLE_EVENT: return "event";
+ case WAPI_HANDLE_NAMEDEVENT: return "named event";
+ default:
+ g_assert_not_reached ();
+ }
}
-static gboolean event_own (gpointer handle)
+static gboolean event_handle_own (gpointer handle, WapiHandleType type)
{
struct _WapiHandle_event *event_handle;
gboolean ok;
-
- ok=_wapi_lookup_handle (handle, WAPI_HANDLE_EVENT,
- (gpointer *)&event_handle);
- if(ok==FALSE) {
- g_warning ("%s: error looking up event handle %p", __func__,
- handle);
- return (FALSE);
+
+ ok = _wapi_lookup_handle (handle, type, (gpointer *)&event_handle);
+ if (!ok) {
+ g_warning ("%s: error looking up %s handle %p",
+ __func__, event_handle_type_to_string (type), handle);
+ return FALSE;
}
-
- MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning event handle %p", __func__, handle);
- if(event_handle->manual==FALSE) {
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning %s handle %p",
+ __func__, event_handle_type_to_string (type), handle);
+
+ if (!event_handle->manual) {
g_assert (event_handle->set_count > 0);
-
- if (--event_handle->set_count == 0) {
+ event_handle->set_count --;
+
+ if (event_handle->set_count == 0)
_wapi_handle_set_signal_state (handle, FALSE, FALSE);
- }
}
- return(TRUE);
+ return TRUE;
+}
+
+static void event_signal(gpointer handle)
+{
+ SetEvent(handle);
+}
+
+static gboolean event_own (gpointer handle)
+{
+ return event_handle_own (handle, WAPI_HANDLE_EVENT);
}
static void namedevent_signal (gpointer handle)
/* NB, always called with the shared handle lock held */
static gboolean namedevent_own (gpointer handle)
{
- struct _WapiHandle_namedevent *namedevent_handle;
- gboolean ok;
-
- MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning named event handle %p", __func__, handle);
-
- ok = _wapi_lookup_handle (handle, WAPI_HANDLE_NAMEDEVENT,
- (gpointer *)&namedevent_handle);
- if (ok == FALSE) {
- g_warning ("%s: error looking up named event handle %p",
- __func__, handle);
- return(FALSE);
- }
-
- if (namedevent_handle->manual == FALSE) {
- g_assert (namedevent_handle->set_count > 0);
-
- if (--namedevent_handle->set_count == 0) {
- _wapi_handle_set_signal_state (handle, FALSE, FALSE);
- }
- }
-
- return (TRUE);
+ return event_handle_own (handle, WAPI_HANDLE_NAMEDEVENT);
}
-static gpointer event_create (WapiSecurityAttributes *security G_GNUC_UNUSED,
- gboolean manual, gboolean initial)
+
+static gpointer event_handle_create (struct _WapiHandle_event *event_handle, WapiHandleType type, gboolean manual, gboolean initial)
{
- struct _WapiHandle_event event_handle = {0};
gpointer handle;
int thr_ret;
-
- /* Need to blow away any old errors here, because code tests
- * for ERROR_ALREADY_EXISTS on success (!) to see if an event
- * was freshly created
- */
- SetLastError (ERROR_SUCCESS);
- MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Creating unnamed event", __func__);
-
- event_handle.manual = manual;
- event_handle.set_count = 0;
+ event_handle->manual = manual;
+ event_handle->set_count = (initial && !manual) ? 1 : 0;
- if (initial == TRUE) {
- if (manual == FALSE) {
- event_handle.set_count = 1;
- }
- }
-
- handle = _wapi_handle_new (WAPI_HANDLE_EVENT, &event_handle);
+ handle = _wapi_handle_new (type, event_handle);
if (handle == _WAPI_HANDLE_INVALID) {
- g_warning ("%s: error creating event handle", __func__);
+ g_warning ("%s: error creating %s handle",
+ __func__, event_handle_type_to_string (type));
SetLastError (ERROR_GEN_FAILURE);
- return(NULL);
+ return NULL;
}
thr_ret = _wapi_handle_lock_handle (handle);
g_assert (thr_ret == 0);
-
- if (initial == TRUE) {
+
+ if (initial)
_wapi_handle_set_signal_state (handle, TRUE, FALSE);
- }
-
- MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: created new event handle %p", __func__, handle);
thr_ret = _wapi_handle_unlock_handle (handle);
g_assert (thr_ret == 0);
- return(handle);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: created %s handle %p",
+ __func__, event_handle_type_to_string (type), handle);
+
+ return handle;
}
-static gpointer namedevent_create (WapiSecurityAttributes *security G_GNUC_UNUSED,
- gboolean manual, gboolean initial,
- const gunichar2 *name G_GNUC_UNUSED)
+static gpointer event_create (gboolean manual, gboolean initial)
+{
+ struct _WapiHandle_event event_handle;
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle",
+ __func__, event_handle_type_to_string (WAPI_HANDLE_EVENT));
+ return event_handle_create (&event_handle, WAPI_HANDLE_EVENT, manual, initial);
+}
+
+static gpointer namedevent_create (gboolean manual, gboolean initial, const gunichar2 *name G_GNUC_UNUSED)
{
- struct _WapiHandle_namedevent namedevent_handle = {{{0}}, 0};
gpointer handle;
gchar *utf8_name;
int thr_ret;
-
- /* w32 seems to guarantee that opening named objects can't
- * race each other
- */
+
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle",
+ __func__, event_handle_type_to_string (WAPI_HANDLE_NAMEDEVENT));
+
+ /* w32 seems to guarantee that opening named objects can't race each other */
thr_ret = _wapi_namespace_lock ();
g_assert (thr_ret == 0);
- /* Need to blow away any old errors here, because code tests
- * for ERROR_ALREADY_EXISTS on success (!) to see if an event
- * was freshly created
- */
- SetLastError (ERROR_SUCCESS);
-
utf8_name = g_utf16_to_utf8 (name, -1, NULL, NULL, NULL);
-
- MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Creating named event [%s]", __func__, utf8_name);
-
- handle = _wapi_search_handle_namespace (WAPI_HANDLE_NAMEDEVENT,
- utf8_name);
+
+ handle = _wapi_search_handle_namespace (WAPI_HANDLE_NAMEDEVENT, utf8_name);
if (handle == _WAPI_HANDLE_INVALID) {
- /* The name has already been used for a different
- * object.
- */
+ /* The name has already been used for a different object. */
+ handle = NULL;
SetLastError (ERROR_INVALID_HANDLE);
- goto cleanup;
} else if (handle) {
- /* Not an error, but this is how the caller is
- * informed that the event wasn't freshly created
- */
+ /* Not an error, but this is how the caller is informed that the event wasn't freshly created */
SetLastError (ERROR_ALREADY_EXISTS);
+
+ /* this is used as creating a new handle */
+ _wapi_handle_ref (handle);
} else {
- /* A new named event, so create both the private and
- * shared parts
- */
-
+ /* A new named event */
+ struct _WapiHandle_namedevent namedevent_handle;
+
strncpy (&namedevent_handle.sharedns.name [0], utf8_name, MAX_PATH);
namedevent_handle.sharedns.name [MAX_PATH] = '\0';
- namedevent_handle.manual = manual;
- namedevent_handle.set_count = 0;
-
- if (initial == TRUE) {
- if (manual == FALSE) {
- namedevent_handle.set_count = 1;
- }
- }
-
- handle = _wapi_handle_new (WAPI_HANDLE_NAMEDEVENT,
- &namedevent_handle);
-
- if (handle == _WAPI_HANDLE_INVALID) {
- g_warning ("%s: error creating event handle", __func__);
- SetLastError (ERROR_GEN_FAILURE);
- goto cleanup;
- }
-
- /* Set the initial state, as this is a completely new
- * handle
- */
- thr_ret = _wapi_handle_lock_handle (handle);
- g_assert (thr_ret == 0);
-
- if (initial == TRUE) {
- _wapi_handle_set_signal_state (handle, TRUE, FALSE);
- }
-
- thr_ret = _wapi_handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
+ handle = event_handle_create ((struct _WapiHandle_event*) &namedevent_handle, WAPI_HANDLE_NAMEDEVENT, manual, initial);
}
- MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: returning event handle %p", __func__, handle);
-
-cleanup:
g_free (utf8_name);
- _wapi_namespace_unlock (NULL);
-
- return handle;
+ thr_ret = _wapi_namespace_unlock (NULL);
+ g_assert (thr_ret == 0);
+ return handle;
}
{
mono_once (&event_ops_once, event_ops_init);
- if (name == NULL) {
- return(event_create (security, manual, initial));
- } else {
- return(namedevent_create (security, manual, initial, name));
- }
-}
-
-static gboolean event_pulse (gpointer handle)
-{
- struct _WapiHandle_event *event_handle;
- gboolean ok;
- int thr_ret;
-
- ok = _wapi_lookup_handle (handle, WAPI_HANDLE_EVENT,
- (gpointer *)&event_handle);
- if (ok == FALSE) {
- g_warning ("%s: error looking up event handle %p", __func__,
- handle);
- return(FALSE);
- }
-
- thr_ret = _wapi_handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
-
- MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Pulsing event handle %p", __func__, handle);
-
- if (event_handle->manual == TRUE) {
- _wapi_handle_set_signal_state (handle, TRUE, TRUE);
- } else {
- event_handle->set_count = 1;
- _wapi_handle_set_signal_state (handle, TRUE, FALSE);
- }
-
- thr_ret = _wapi_handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
-
- if (event_handle->manual == TRUE) {
- /* For a manual-reset event, we're about to try and
- * get the handle lock again, so give other threads a
- * chance
- */
- sched_yield ();
-
- /* Reset the handle signal state */
- /* I'm not sure whether or not we need a barrier here
- * to make sure that all threads waiting on the event
- * have proceeded. Currently we rely on broadcasting
- * a condition.
- */
- MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Obtained write lock on event handle %p",
- __func__, handle);
-
- thr_ret = _wapi_handle_lock_handle (handle);
- g_assert (thr_ret == 0);
-
- _wapi_handle_set_signal_state (handle, FALSE, FALSE);
-
- thr_ret = _wapi_handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
- }
-
- return(TRUE);
-}
-
-static gboolean namedevent_pulse (gpointer handle)
-{
- struct _WapiHandle_namedevent *namedevent_handle;
- gboolean ok;
- int thr_ret;
-
- ok = _wapi_lookup_handle (handle, WAPI_HANDLE_NAMEDEVENT,
- (gpointer *)&namedevent_handle);
- if (ok == FALSE) {
- g_warning ("%s: error looking up named event handle %p",
- __func__, handle);
- return(FALSE);
- }
-
- thr_ret = _wapi_handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
-
- MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Pulsing named event handle %p", __func__, handle);
-
- if (namedevent_handle->manual == TRUE) {
- _wapi_handle_set_signal_state (handle, TRUE, TRUE);
- } else {
- namedevent_handle->set_count = 1;
- _wapi_handle_set_signal_state (handle, TRUE, FALSE);
- }
-
- thr_ret = _wapi_handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
-
- if (namedevent_handle->manual == TRUE) {
- /* For a manual-reset event, we're about to try and
- * get the handle lock again, so give other processes
- * a chance
- */
- _wapi_handle_spin (200);
-
- /* Reset the handle signal state */
- /* I'm not sure whether or not we need a barrier here
- * to make sure that all threads waiting on the event
- * have proceeded. Currently we rely on waiting for
- * twice the shared handle poll interval.
- */
- MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Obtained write lock on event handle %p",
- __func__, handle);
-
- thr_ret = _wapi_handle_lock_handle (handle);
- g_assert (thr_ret == 0);
-
- _wapi_handle_set_signal_state (handle, FALSE, FALSE);
-
- thr_ret = _wapi_handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
- }
+ /* Need to blow away any old errors here, because code tests
+ * for ERROR_ALREADY_EXISTS on success (!) to see if an event
+ * was freshly created
+ */
+ SetLastError (ERROR_SUCCESS);
- return(TRUE);
+ return name ? namedevent_create (manual, initial, name) : event_create (manual, initial);
}
/**
gboolean PulseEvent(gpointer handle)
{
WapiHandleType type;
-
+ struct _WapiHandle_event *event_handle;
+ int thr_ret;
+
if (handle == NULL) {
SetLastError (ERROR_INVALID_HANDLE);
return(FALSE);
}
-
- type = _wapi_handle_type (handle);
-
- if (event_ops[type].pulse == NULL) {
+
+ switch (type = _wapi_handle_type (handle)) {
+ case WAPI_HANDLE_EVENT:
+ case WAPI_HANDLE_NAMEDEVENT:
+ break;
+ default:
SetLastError (ERROR_INVALID_HANDLE);
- return(FALSE);
+ return FALSE;
}
-
- return(event_ops[type].pulse (handle));
-}
-static gboolean event_reset (gpointer handle)
-{
- struct _WapiHandle_event *event_handle;
- gboolean ok;
- int thr_ret;
-
- ok = _wapi_lookup_handle (handle, WAPI_HANDLE_EVENT,
- (gpointer *)&event_handle);
- if (ok == FALSE) {
- g_warning ("%s: error looking up event handle %p",
- __func__, handle);
- return(FALSE);
+ if (!_wapi_lookup_handle (handle, type, (gpointer *)&event_handle)) {
+ g_warning ("%s: error looking up %s handle %p",
+ __func__, event_handle_type_to_string (type), handle);
+ return FALSE;
}
- MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Resetting event handle %p", __func__, handle);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: pulsing %s handle %p",
+ __func__, event_handle_type_to_string (type), handle);
thr_ret = _wapi_handle_lock_handle (handle);
g_assert (thr_ret == 0);
-
- if (_wapi_handle_issignalled (handle) == FALSE) {
- MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: No need to reset event handle %p", __func__,
- handle);
+
+ if (!event_handle->manual) {
+ event_handle->set_count = 1;
+ _wapi_handle_set_signal_state (handle, TRUE, FALSE);
} else {
- MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Obtained write lock on event handle %p",
- __func__, handle);
+ _wapi_handle_set_signal_state (handle, TRUE, TRUE);
- _wapi_handle_set_signal_state (handle, FALSE, FALSE);
- }
-
- event_handle->set_count = 0;
-
- thr_ret = _wapi_handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
-
- return(TRUE);
-}
+ thr_ret = _wapi_handle_unlock_handle (handle);
+ g_assert (thr_ret == 0);
-static gboolean namedevent_reset (gpointer handle)
-{
- struct _WapiHandle_namedevent *namedevent_handle;
- gboolean ok;
- int thr_ret;
-
- ok = _wapi_lookup_handle (handle, WAPI_HANDLE_NAMEDEVENT,
- (gpointer *)&namedevent_handle);
- if (ok == FALSE) {
- g_warning ("%s: error looking up named event handle %p",
- __func__, handle);
- return(FALSE);
- }
+ /* For a manual-reset event, we're about to try and get the handle
+ * lock again, so give other threads a chance */
+ sched_yield ();
- MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Resetting named event handle %p", __func__, handle);
+ /* Reset the handle signal state */
- thr_ret = _wapi_handle_lock_handle (handle);
- g_assert (thr_ret == 0);
-
- if (_wapi_handle_issignalled (handle) == FALSE) {
- MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: No need to reset named event handle %p",
- __func__, handle);
- } else {
- MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Obtained write lock on named event handle %p",
- __func__, handle);
+ /* I'm not sure whether or not we need a barrier here to make sure
+ * that all threads waiting on the event have proceeded. Currently
+ * we rely on broadcasting a condition. */
+
+ thr_ret = _wapi_handle_lock_handle (handle);
+ g_assert (thr_ret == 0);
_wapi_handle_set_signal_state (handle, FALSE, FALSE);
}
-
- namedevent_handle->set_count = 0;
-
+
thr_ret = _wapi_handle_unlock_handle (handle);
g_assert (thr_ret == 0);
-
- return(TRUE);
+
+ return TRUE;
}
/**
gboolean ResetEvent(gpointer handle)
{
WapiHandleType type;
+ struct _WapiHandle_event *event_handle;
+ int thr_ret;
+
+ SetLastError (ERROR_SUCCESS);
if (handle == NULL) {
SetLastError (ERROR_INVALID_HANDLE);
return(FALSE);
}
- type = _wapi_handle_type (handle);
-
- if (event_ops[type].reset == NULL) {
+ switch (type = _wapi_handle_type (handle)) {
+ case WAPI_HANDLE_EVENT:
+ case WAPI_HANDLE_NAMEDEVENT:
+ break;
+ default:
SetLastError (ERROR_INVALID_HANDLE);
- return(FALSE);
+ return FALSE;
}
-
- return(event_ops[type].reset (handle));
-}
-static gboolean event_set (gpointer handle)
-{
- struct _WapiHandle_event *event_handle;
- gboolean ok;
- int thr_ret;
-
- ok = _wapi_lookup_handle (handle, WAPI_HANDLE_EVENT,
- (gpointer *)&event_handle);
- if (ok == FALSE) {
- g_warning ("%s: error looking up event handle %p", __func__,
- handle);
- return(FALSE);
+ if (!_wapi_lookup_handle (handle, type, (gpointer *)&event_handle)) {
+ g_warning ("%s: error looking up %s handle %p",
+ __func__, event_handle_type_to_string (type), handle);
+ return FALSE;
}
-
- thr_ret = _wapi_handle_lock_handle (handle);
- g_assert (thr_ret == 0);
-
- MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Setting event handle %p", __func__, handle);
- if (event_handle->manual == TRUE) {
- _wapi_handle_set_signal_state (handle, TRUE, TRUE);
- } else {
- event_handle->set_count = 1;
- _wapi_handle_set_signal_state (handle, TRUE, FALSE);
- }
-
- thr_ret = _wapi_handle_unlock_handle (handle);
- g_assert (thr_ret == 0);
-
- return(TRUE);
-}
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: resetting %s handle %p",
+ __func__, event_handle_type_to_string (type), handle);
-static gboolean namedevent_set (gpointer handle)
-{
- struct _WapiHandle_namedevent *namedevent_handle;
- gboolean ok;
- int thr_ret;
-
- ok = _wapi_lookup_handle (handle, WAPI_HANDLE_NAMEDEVENT,
- (gpointer *)&namedevent_handle);
- if (ok == FALSE) {
- g_warning ("%s: error looking up named event handle %p",
- __func__, handle);
- return(FALSE);
- }
-
thr_ret = _wapi_handle_lock_handle (handle);
g_assert (thr_ret == 0);
- MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Setting named event handle %p", __func__, handle);
-
- if (namedevent_handle->manual == TRUE) {
- _wapi_handle_set_signal_state (handle, TRUE, TRUE);
+ if (!_wapi_handle_issignalled (handle)) {
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: no need to reset %s handle %p",
+ __func__, event_handle_type_to_string (type), handle);
} else {
- namedevent_handle->set_count = 1;
- _wapi_handle_set_signal_state (handle, TRUE, TRUE);
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: obtained write lock on %s handle %p",
+ __func__, event_handle_type_to_string (type), handle);
+
+ _wapi_handle_set_signal_state (handle, FALSE, FALSE);
}
+ event_handle->set_count = 0;
+
thr_ret = _wapi_handle_unlock_handle (handle);
g_assert (thr_ret == 0);
- return(TRUE);
+ return TRUE;
}
/**
gboolean SetEvent(gpointer handle)
{
WapiHandleType type;
+ struct _WapiHandle_event *event_handle;
+ int thr_ret;
if (handle == NULL) {
SetLastError (ERROR_INVALID_HANDLE);
return(FALSE);
}
- type = _wapi_handle_type (handle);
-
- if (event_ops[type].set == NULL) {
+ switch (type = _wapi_handle_type (handle)) {
+ case WAPI_HANDLE_EVENT:
+ case WAPI_HANDLE_NAMEDEVENT:
+ break;
+ default:
SetLastError (ERROR_INVALID_HANDLE);
- return(FALSE);
+ return FALSE;
}
-
- return(event_ops[type].set (handle));
+
+ if (!_wapi_lookup_handle (handle, type, (gpointer *)&event_handle)) {
+ g_warning ("%s: error looking up %s handle %p",
+ __func__, event_handle_type_to_string (type), handle);
+ return FALSE;
+ }
+
+ MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: setting %s handle %p",
+ __func__, event_handle_type_to_string (type), handle);
+
+ thr_ret = _wapi_handle_lock_handle (handle);
+ g_assert (thr_ret == 0);
+
+ if (!event_handle->manual) {
+ event_handle->set_count = 1;
+ _wapi_handle_set_signal_state (handle, TRUE, FALSE);
+ } else {
+ _wapi_handle_set_signal_state (handle, TRUE, TRUE);
+ }
+
+ thr_ret = _wapi_handle_unlock_handle (handle);
+ g_assert (thr_ret == 0);
+
+ return TRUE;
}
gpointer OpenEvent (guint32 access G_GNUC_UNUSED, gboolean inherit G_GNUC_UNUSED, const gunichar2 *name)