avoid using PL_sv_mutex in condpair_magic() (avoids hangs when
[p5sagit/p5-mst-13.2.git] / util.c
diff --git a/util.c b/util.c
index 3db5b02..f39ccd1 100644 (file)
--- a/util.c
+++ b/util.c
@@ -2824,11 +2824,11 @@ condpair_magic(SV *sv)
        COND_INIT(&cp->owner_cond);
        COND_INIT(&cp->cond);
        cp->owner = 0;
-       LOCK_SV_MUTEX;
+       MUTEX_LOCK(&PL_cred_mutex);             /* XXX need separate mutex? */
        mg = mg_find(sv, 'm');
        if (mg) {
            /* someone else beat us to initialising it */
-           UNLOCK_SV_MUTEX;
+           MUTEX_UNLOCK(&PL_cred_mutex);       /* XXX need separate mutex? */
            MUTEX_DESTROY(&cp->mutex);
            COND_DESTROY(&cp->owner_cond);
            COND_DESTROY(&cp->cond);
@@ -2839,7 +2839,7 @@ condpair_magic(SV *sv)
            mg = SvMAGIC(sv);
            mg->mg_ptr = (char *)cp;
            mg->mg_len = sizeof(cp);
-           UNLOCK_SV_MUTEX;
+           MUTEX_UNLOCK(&PL_cred_mutex);       /* XXX need separate mutex? */
            DEBUG_S(WITH_THR(PerlIO_printf(PerlIO_stderr(),
                                           "%p: condpair_magic %p\n", thr, sv));)
        }