-/*
- * w32handle.c: Generic and internal operations on handles
+/**
+ * \file
+ * Generic and internal operations on handles
*
* Author:
* Dick Porter (dick@ximian.com)
#undef DEBUG_REFS
-#define SLOT_MAX (1024 * 16)
+#define SLOT_MAX (1024 * 32)
/* must be a power of 2 */
#define HANDLE_PER_SLOT (256)
mono_w32handle_unref (handle);
}
-/*
- * wapi_init:
- *
- * Initialize the io-layer.
- */
void
mono_w32handle_init (void)
{
return(GUINT_TO_POINTER(fd));
}
+gboolean
+mono_w32handle_close (gpointer handle)
+{
+ if (handle == INVALID_HANDLE_VALUE)
+ return FALSE;
+ if (handle == (gpointer) 0 && mono_w32handle_get_type (handle) != MONO_W32HANDLE_CONSOLE) {
+ /* Problem: because we map file descriptors to the
+ * same-numbered handle we can't tell the difference
+ * between a bogus handle and the handle to stdin.
+ * Assume that it's the console handle if that handle
+ * exists... */
+ return FALSE;
+ }
+
+ mono_w32handle_unref (handle);
+ return TRUE;
+}
+
gboolean
mono_w32handle_lookup (gpointer handle, MonoW32HandleType type,
gpointer *handle_specific)
type = handle_data->type;
if (handle_ops[type] != NULL && handle_ops[type]->signal != NULL) {
- handle_ops[type]->signal (handle);
+ handle_ops[type]->signal (handle, handle_data->specific);
}
}