#define _MONO_UTILS_W32HANDLE_H_
#include <config.h>
-
-#if !defined(HOST_WIN32)
-
#include <glib.h>
+#ifndef INVALID_HANDLE_VALUE
#define INVALID_HANDLE_VALUE (gpointer)-1
+#endif
+
+#define MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS 64
typedef enum {
MONO_W32HANDLE_UNUSED = 0,
/* Called by WaitForSingleObject and WaitForMultipleObjects,
* with the handle locked (shared handles aren't locked.)
* Returns TRUE if ownership was established, false otherwise.
+ * If TRUE, *statuscode contains a status code such as
+ * WAIT_OBJECT_0 or WAIT_ABANDONED_0.
*/
- gboolean (*own_handle)(gpointer handle);
+ gboolean (*own_handle)(gpointer handle, guint32 *statuscode);
/* Called by WaitForSingleObject and WaitForMultipleObjects, if the
* handle in question is "ownable" (ie mutexes), to see if the current
* instead of using the normal handle signal mechanism.
* Returns the WaitForSingleObject return code.
*/
- guint32 (*special_wait)(gpointer handle, guint32 timeout, gboolean alertable);
+ guint32 (*special_wait)(gpointer handle, guint32 timeout, gboolean *alerted);
/* Called by WaitForSingleObject and WaitForMultipleObjects,
* if the handle in question needs some preprocessing before the
mono_w32handle_ops_signal (gpointer handle);
gboolean
-mono_w32handle_ops_own (gpointer handle);
+mono_w32handle_ops_own (gpointer handle, guint32 *statuscode);
gboolean
mono_w32handle_ops_isowned (gpointer handle);
guint32
-mono_w32handle_ops_specialwait (gpointer handle, guint32 timeout, gboolean alertable);
+mono_w32handle_ops_specialwait (gpointer handle, guint32 timeout, gboolean *alerted);
void
mono_w32handle_ops_prewait (gpointer handle);
gsize
mono_w32handle_ops_typesize (MonoW32HandleType type);
-gboolean
-mono_w32handle_count_signalled_handles (guint32 numhandles, gpointer *handles, gboolean waitall, guint32 *retcount, guint32 *lowest);
-
-void
-mono_w32handle_unlock_handles (guint32 numhandles, gpointer *handles);
-
-int
-mono_w32handle_timedwait_signal_handle (gpointer handle, guint32 timeout, gboolean poll, gboolean *alerted);
-
-int
-mono_w32handle_timedwait_signal (guint32 timeout, gboolean poll, gboolean *alerted);
-
void
mono_w32handle_set_signal_state (gpointer handle, gboolean state, gboolean broadcast);
int
mono_w32handle_unlock_handle (gpointer handle);
-int
-mono_w32handle_lock_signal_mutex (void);
+typedef enum {
+ MONO_W32HANDLE_WAIT_RET_SUCCESS_0 = 0,
+ MONO_W32HANDLE_WAIT_RET_ABANDONED_0 = MONO_W32HANDLE_WAIT_RET_SUCCESS_0 + MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS,
+ MONO_W32HANDLE_WAIT_RET_ALERTED = -1,
+ MONO_W32HANDLE_WAIT_RET_TIMEOUT = -2,
+ MONO_W32HANDLE_WAIT_RET_FAILED = -3,
+} MonoW32HandleWaitRet;
-int
-mono_w32handle_unlock_signal_mutex (void);
+MonoW32HandleWaitRet
+mono_w32handle_wait_one (gpointer handle, guint32 timeout, gboolean alertable);
+
+MonoW32HandleWaitRet
+mono_w32handle_wait_multiple (gpointer *handles, gsize nhandles, gboolean waitall, guint32 timeout, gboolean alertable);
-#endif /* !defined(HOST_WIN32) */
+MonoW32HandleWaitRet
+mono_w32handle_signal_and_wait (gpointer signal_handle, gpointer wait_handle, guint32 timeout, gboolean alertable);
#endif /* _MONO_UTILS_W32HANDLE_H_ */