+ 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);
+ }
+
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: abandoning %s handle %p",
+ __func__, mono_w32handle_ops_typename (type), handle);
+
+ tid = MONO_UINT_TO_NATIVE_THREAD_ID (internal->tid);
+
+ if (!pthread_equal (mutex_handle->tid, tid))
+ g_error ("%s: trying to release mutex %p acquired by thread %p from thread %p",
+ __func__, handle, (gpointer) mutex_handle->tid, (gpointer) tid);
+
+ thr_ret = mono_w32handle_lock_handle (handle);
+ g_assert (thr_ret == 0);