Author: dick
Date: 2005-04-04 06:46:38 -0400 (Mon, 04 Apr 2005)
New Revision: 42507
Modified:
branches/dick/io-layer-no-daemon/handles.c
branches/dick/io-layer-no-daemon/mutexes.c
Log:
The handle mutexes aren't used with shared handle types, so don't try and
destroy them.
Modified: branches/dick/io-layer-no-daemon/handles.c
===================================================================
--- branches/dick/io-layer-no-daemon/handles.c 2005-04-04 09:42:19 UTC (rev
42506)
+++ branches/dick/io-layer-no-daemon/handles.c 2005-04-04 10:46:38 UTC (rev
42507)
@@ -883,6 +883,8 @@
#endif
if(destroy==TRUE) {
+ WapiHandleType type = _wapi_private_handles[idx].type;
+
#ifdef DEBUG
g_message ("%s: Destroying handle %p", __func__, handle);
#endif
@@ -894,16 +896,18 @@
_wapi_private_handles[idx].type = WAPI_HANDLE_UNUSED;
- /* Destroy the mutex and cond var. We hope nobody
- * tried to grab them between the handle unlock and
- * now, but pthreads doesn't have a
- * "unlock_and_destroy" atomic function.
- */
- thr_ret = mono_mutex_destroy
(&_wapi_private_handles[idx].signal_mutex);
- g_assert (thr_ret == 0);
-
- thr_ret = pthread_cond_destroy
(&_wapi_private_handles[idx].signal_cond);
- g_assert (thr_ret == 0);
+ if (!_WAPI_SHARED_HANDLE(type)) {
+ /* Destroy the mutex and cond var. We hope nobody
+ * tried to grab them between the handle unlock and
+ * now, but pthreads doesn't have a
+ * "unlock_and_destroy" atomic function.
+ */
+ thr_ret = mono_mutex_destroy
(&_wapi_private_handles[idx].signal_mutex);
+ g_assert (thr_ret == 0);
+
+ thr_ret = pthread_cond_destroy
(&_wapi_private_handles[idx].signal_cond);
+ g_assert (thr_ret == 0);
+ }
/* The garbage collector will take care of shared data
* if this is a shared handle
Modified: branches/dick/io-layer-no-daemon/mutexes.c
===================================================================
--- branches/dick/io-layer-no-daemon/mutexes.c 2005-04-04 09:42:19 UTC (rev
42506)
+++ branches/dick/io-layer-no-daemon/mutexes.c 2005-04-04 10:46:38 UTC (rev
42507)
@@ -43,8 +43,13 @@
{
struct _WapiHandle_mutex *mut = (struct _WapiHandle_mutex *)handle_info;
+#ifdef PTHREAD_POINTER_ID
+ g_print ("own: %5d:%5p, count: %5u", mut->pid, mut->tid,
+ mut->recursion);
+#else
g_print ("own: %5d:%5ld, count: %5u", mut->pid, mut->tid,
mut->recursion);
+#endif
}
struct _WapiHandleOps _wapi_namedmutex_ops = {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches