cleanup_close (gpointer handle, gpointer data, gpointer user_data)
{
if (mono_w32handle_get_type (handle) == MONO_W32HANDLE_SOCKET)
- mono_w32handle_ops_close (handle, data);
+ mono_w32handle_force_close (handle, data);
return FALSE;
}
ok = mono_w32handle_lookup (handle, type, (gpointer *)&event_handle);
if (!ok) {
g_warning ("%s: error looking up %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
return FALSE;
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
if (!event_handle->manual) {
g_assert (event_handle->set_count > 0);
handle = mono_w32handle_new (type, event_handle);
if (handle == INVALID_HANDLE_VALUE) {
g_warning ("%s: error creating %s handle",
- __func__, mono_w32handle_ops_typename (type));
+ __func__, mono_w32handle_get_typename (type));
SetLastError (ERROR_GEN_FAILURE);
return NULL;
}
mono_w32handle_unlock_handle (handle);
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: created %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
return handle;
}
{
MonoW32HandleEvent event_handle;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle",
- __func__, mono_w32handle_ops_typename (MONO_W32HANDLE_EVENT));
+ __func__, mono_w32handle_get_typename (MONO_W32HANDLE_EVENT));
return event_handle_create (&event_handle, MONO_W32HANDLE_EVENT, manual, initial);
}
gchar *utf8_name;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle",
- __func__, mono_w32handle_ops_typename (MONO_W32HANDLE_NAMEDEVENT));
+ __func__, mono_w32handle_get_typename (MONO_W32HANDLE_NAMEDEVENT));
/* w32 seems to guarantee that opening named objects can't race each other */
mono_w32handle_namespace_lock ();
if (!mono_w32handle_lookup (handle, type, (gpointer *)&event_handle)) {
g_warning ("%s: error looking up %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
return FALSE;
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: setting %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
mono_w32handle_lock_handle (handle);
if (!mono_w32handle_lookup (handle, type, (gpointer *)&event_handle)) {
g_warning ("%s: error looking up %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
return FALSE;
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: resetting %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
mono_w32handle_lock_handle (handle);
if (!mono_w32handle_issignalled (handle)) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: no need to reset %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
} else {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: obtained write lock on %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
mono_w32handle_set_signal_state (handle, FALSE, FALSE);
}
if (type != search_data->type) {
/* Its the wrong type, so fail now */
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p matches name but is wrong type: %s",
- __func__, handle, mono_w32handle_ops_typename (type));
+ __func__, handle, mono_w32handle_get_typename (type));
search_data->ret = INVALID_HANDLE_VALUE;
} else {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p matches name and type",
g_error ("%s: type %s does not have a namespace", __func__, type);
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Lookup for handle named [%s] type %s",
- __func__, name, mono_w32handle_ops_typename (type));
+ __func__, name, mono_w32handle_get_typename (type));
search_data.ret = NULL;
search_data.type = type;
return handle_data->type;
}
+static const gchar*
+mono_w32handle_ops_typename (MonoW32HandleType type);
+
+const gchar*
+mono_w32handle_get_typename (MonoW32HandleType type)
+{
+ return mono_w32handle_ops_typename (type);
+}
+
void
mono_w32handle_set_signal_state (gpointer handle, gboolean state, gboolean broadcast)
{
g_free (private_handles [i]);
}
+static gsize
+mono_w32handle_ops_typesize (MonoW32HandleType type);
+
static void mono_w32handle_init_handle (MonoW32HandleBase *handle,
MonoW32HandleType type, gpointer handle_specific)
{
}
}
+static void
+mono_w32handle_ops_close (gpointer handle, gpointer data);
+
+void
+mono_w32handle_force_close (gpointer handle, gpointer data)
+{
+ mono_w32handle_ops_close (handle, data);
+}
+
void
mono_w32handle_register_ops (MonoW32HandleType type, MonoW32HandleOps *ops)
{
return (NULL);
}
-void mono_w32handle_ops_close (gpointer handle, gpointer data)
+static void
+mono_w32handle_ops_close (gpointer handle, gpointer data)
{
MonoW32HandleBase *handle_data;
MonoW32HandleType type;
}
}
-void mono_w32handle_ops_details (MonoW32HandleType type, gpointer data)
+static void
+mono_w32handle_ops_details (MonoW32HandleType type, gpointer data)
{
if (handle_ops[type] != NULL &&
handle_ops[type]->details != NULL) {
}
}
-const gchar* mono_w32handle_ops_typename (MonoW32HandleType type)
+static const gchar*
+mono_w32handle_ops_typename (MonoW32HandleType type)
{
g_assert (handle_ops [type]);
g_assert (handle_ops [type]->typename);
return handle_ops [type]->typename ();
}
-gsize mono_w32handle_ops_typesize (MonoW32HandleType type)
+static gsize
+mono_w32handle_ops_typesize (MonoW32HandleType type)
{
g_assert (handle_ops [type]);
g_assert (handle_ops [type]->typesize);
return handle_ops [type]->typesize ();
}
-void mono_w32handle_ops_signal (gpointer handle)
+static void
+mono_w32handle_ops_signal (gpointer handle)
{
MonoW32HandleBase *handle_data;
MonoW32HandleType type;
}
}
-gboolean mono_w32handle_ops_own (gpointer handle, guint32 *statuscode)
+static gboolean
+mono_w32handle_ops_own (gpointer handle, guint32 *statuscode)
{
MonoW32HandleBase *handle_data;
MonoW32HandleType type;
}
}
-gboolean mono_w32handle_ops_isowned (gpointer handle)
+static gboolean
+mono_w32handle_ops_isowned (gpointer handle)
{
MonoW32HandleBase *handle_data;
MonoW32HandleType type;
}
}
-MonoW32HandleWaitRet
+static MonoW32HandleWaitRet
mono_w32handle_ops_specialwait (gpointer handle, guint32 timeout, gboolean *alerted)
{
MonoW32HandleBase *handle_data;
}
}
-void mono_w32handle_ops_prewait (gpointer handle)
+static void
+mono_w32handle_ops_prewait (gpointer handle)
{
MonoW32HandleBase *handle_data;
MonoW32HandleType type;
MonoW32HandleType
mono_w32handle_get_type (gpointer handle);
+const gchar*
+mono_w32handle_get_typename (MonoW32HandleType type);
+
gboolean
mono_w32handle_lookup (gpointer handle, MonoW32HandleType type, gpointer *handle_specific);
mono_w32handle_test_capabilities (gpointer handle, MonoW32HandleCapability caps);
void
-mono_w32handle_ops_close (gpointer handle, gpointer data);
-
-void
-mono_w32handle_ops_signal (gpointer handle);
-
-gboolean
-mono_w32handle_ops_own (gpointer handle, guint32 *statuscode);
-
-gboolean
-mono_w32handle_ops_isowned (gpointer handle);
-
-MonoW32HandleWaitRet
-mono_w32handle_ops_specialwait (gpointer handle, guint32 timeout, gboolean *alerted);
-
-void
-mono_w32handle_ops_prewait (gpointer handle);
-
-void
-mono_w32handle_ops_details (MonoW32HandleType type, gpointer data);
-
-const gchar*
-mono_w32handle_ops_typename (MonoW32HandleType type);
-
-gsize
-mono_w32handle_ops_typesize (MonoW32HandleType type);
+mono_w32handle_force_close (gpointer handle, gpointer data);
void
mono_w32handle_set_signal_state (gpointer handle, gboolean state, gboolean broadcast);
*statuscode = WAIT_OBJECT_0;
if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
- g_warning ("%s: error looking up %s handle %p", __func__, mono_w32handle_ops_typename (type), handle);
+ g_warning ("%s: error looking up %s handle %p", __func__, mono_w32handle_get_typename (type), handle);
return FALSE;
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning %s handle %p, before: [tid: %p, recursion: %d], after: [tid: %p, recursion: %d], abandoned: %s",
- __func__, mono_w32handle_ops_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion, (gpointer) pthread_self (), mutex_handle->recursion + 1, mutex_handle->abandoned ? "true" : "false");
+ __func__, mono_w32handle_get_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion, (gpointer) pthread_self (), mutex_handle->recursion + 1, mutex_handle->abandoned ? "true" : "false");
if (mutex_handle->recursion != 0) {
g_assert (pthread_equal (pthread_self (), mutex_handle->tid));
MonoW32HandleMutex *mutex_handle;
if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
- g_warning ("%s: error looking up %s handle %p", __func__, mono_w32handle_ops_typename (type), handle);
+ g_warning ("%s: error looking up %s handle %p", __func__, mono_w32handle_get_typename (type), handle);
return FALSE;
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: testing ownership %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
if (mutex_handle->recursion > 0 && pthread_equal (mutex_handle->tid, pthread_self ())) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p owned by %p",
- __func__, mono_w32handle_ops_typename (type), handle, (gpointer) pthread_self ());
+ __func__, mono_w32handle_get_typename (type), handle, (gpointer) pthread_self ());
return TRUE;
} else {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p not owned by %p, tid: %p recursion: %d",
- __func__, mono_w32handle_ops_typename (type), handle, (gpointer) pthread_self (), (gpointer) mutex_handle->tid, mutex_handle->recursion);
+ __func__, mono_w32handle_get_typename (type), handle, (gpointer) pthread_self (), (gpointer) mutex_handle->tid, mutex_handle->recursion);
return FALSE;
}
}
if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
g_warning ("%s: error looking up %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
return;
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: pre-waiting %s handle %p, owned? %s",
- __func__, mono_w32handle_ops_typename (type), handle, mutex_handle->recursion != 0 ? "true" : "false");
+ __func__, mono_w32handle_get_typename (type), handle, mutex_handle->recursion != 0 ? "true" : "false");
}
/* The shared state is not locked when prewait methods are called */
handle = mono_w32handle_new (type, mutex_handle);
if (handle == INVALID_HANDLE_VALUE) {
g_warning ("%s: error creating %s handle",
- __func__, mono_w32handle_ops_typename (type));
+ __func__, mono_w32handle_get_typename (type));
SetLastError (ERROR_GEN_FAILURE);
return NULL;
}
mono_w32handle_unlock_handle (handle);
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: created %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
return handle;
}
{
MonoW32HandleMutex mutex_handle;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle",
- __func__, mono_w32handle_ops_typename (MONO_W32HANDLE_MUTEX));
+ __func__, mono_w32handle_get_typename (MONO_W32HANDLE_MUTEX));
return mutex_handle_create (&mutex_handle, MONO_W32HANDLE_MUTEX, owned);
}
gchar *utf8_name;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle",
- __func__, mono_w32handle_ops_typename (MONO_W32HANDLE_NAMEDMUTEX));
+ __func__, mono_w32handle_get_typename (MONO_W32HANDLE_NAMEDMUTEX));
/* w32 seems to guarantee that opening named objects can't race each other */
mono_w32handle_namespace_lock ();
if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
g_warning ("%s: error looking up %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
return FALSE;
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: releasing %s handle %p, tid: %p recursion: %d",
- __func__, mono_w32handle_ops_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion);
+ __func__, mono_w32handle_get_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion);
mono_w32handle_lock_handle (handle);
ret = FALSE;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: we don't own %s handle %p (owned by %ld, me %ld)",
- __func__, mono_w32handle_ops_typename (type), handle, (long)mutex_handle->tid, (long)tid);
+ __func__, mono_w32handle_get_typename (type), handle, (long)mutex_handle->tid, (long)tid);
} else {
ret = TRUE;
thread_disown_mutex (mono_thread_internal_current (), handle);
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unlocking %s handle %p, tid: %p recusion : %d",
- __func__, mono_w32handle_ops_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion);
+ __func__, mono_w32handle_get_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion);
mutex_handle->tid = 0;
mono_w32handle_set_signal_state (handle, TRUE, FALSE);
if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
g_error ("%s: error looking up %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: abandoning %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
tid = MONO_UINT_TO_NATIVE_THREAD_ID (internal->tid);
thread_disown_mutex (internal, handle);
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: abandoned %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
mono_w32handle_unlock_handle (handle);
}
if (!mono_w32handle_lookup (handle, type, (gpointer *)&sem_handle)) {
g_warning ("%s: error looking up %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
return FALSE;
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
sem_handle->val--;
handle = mono_w32handle_new (type, sem_handle);
if (handle == INVALID_HANDLE_VALUE) {
g_warning ("%s: error creating %s handle",
- __func__, mono_w32handle_ops_typename (type));
+ __func__, mono_w32handle_get_typename (type));
SetLastError (ERROR_GEN_FAILURE);
return NULL;
}
mono_w32handle_unlock_handle (handle);
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: created %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
return handle;
}
{
MonoW32HandleSemaphore sem_handle;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle, initial %d max %d",
- __func__, mono_w32handle_ops_typename (MONO_W32HANDLE_SEM), initial, max);
+ __func__, mono_w32handle_get_typename (MONO_W32HANDLE_SEM), initial, max);
return sem_handle_create (&sem_handle, MONO_W32HANDLE_SEM, initial, max);
}
gchar *utf8_name;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle, initial %d max %d name \"%s\"",
- __func__, mono_w32handle_ops_typename (MONO_W32HANDLE_NAMEDSEM), initial, max, (const char*)name);
+ __func__, mono_w32handle_get_typename (MONO_W32HANDLE_NAMEDSEM), initial, max, (const char*)name);
/* w32 seems to guarantee that opening named objects can't race each other */
mono_w32handle_namespace_lock ();
}
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: releasing %s handle %p",
- __func__, mono_w32handle_ops_typename (type), handle);
+ __func__, mono_w32handle_get_typename (type), handle);
mono_w32handle_lock_handle (handle);
/* No idea why max is signed, but thats the spec :-( */
if (sem_handle->val + releaseCount > (guint32)sem_handle->max) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p val %d count %d max %d, max value would be exceeded",
- __func__, mono_w32handle_ops_typename (type), handle, sem_handle->val, releaseCount, sem_handle->max);
+ __func__, mono_w32handle_get_typename (type), handle, sem_handle->val, releaseCount, sem_handle->max);
ret = FALSE;
} else {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p val %d count %d max %d",
- __func__, mono_w32handle_ops_typename (type), handle, sem_handle->val, releaseCount, sem_handle->max);
+ __func__, mono_w32handle_get_typename (type), handle, sem_handle->val, releaseCount, sem_handle->max);
sem_handle->val += releaseCount;
mono_w32handle_set_signal_state (handle, TRUE, TRUE);