Debugging output for lock handling.
Malcolm Beattie [Wed, 10 Sep 1997 16:39:41 +0000 (16:39 +0000)]
p4raw-id: //depot/perl@64

mg.c
pp.c
pp_hot.c
util.c

diff --git a/mg.c b/mg.c
index 305f00f..56fb495 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -1626,6 +1626,8 @@ SV *sv;
 MAGIC *mg;
 {
     dTHR;
+    DEBUG_L(PerlIO_printf(PerlIO_stderr(), "0x%lx: magic_mutexfree 0x%lx\n",
+                         (unsigned long)thr, (unsigned long)sv);)
     if (MgOWNER(mg))
        croak("panic: magic_mutexfree");
     MUTEX_DESTROY(MgMUTEXP(mg));
diff --git a/pp.c b/pp.c
index 6761a1f..01c61c2 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -4128,6 +4128,8 @@ void *svv;
        croak("panic: unlock_condpair unlocking mutex that we don't own");
     MgOWNER(mg) = 0;
     COND_SIGNAL(MgOWNERCONDP(mg));
+    DEBUG_L(PerlIO_printf(PerlIO_stderr(), "0x%lx: unlock 0x%lx\n",
+                         (unsigned long)thr, (unsigned long)svv);)
     MUTEX_UNLOCK(MgMUTEXP(mg));
 }
 #endif /* USE_THREADS */
@@ -4150,6 +4152,8 @@ PP(pp_lock)
        while (MgOWNER(mg))
            COND_WAIT(MgOWNERCONDP(mg), MgMUTEXP(mg));
        MgOWNER(mg) = thr;
+       DEBUG_L(PerlIO_printf(PerlIO_stderr(), "0x%lx: pp_lock lock 0x%lx\n",
+                             (unsigned long)thr, (unsigned long)sv);)
        MUTEX_UNLOCK(MgMUTEXP(mg));
        save_destructor(unlock_condpair, sv);
     }
index fce7437..334a60d 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1897,6 +1897,9 @@ PP(pp_entersub)
            while (MgOWNER(mg))
                COND_WAIT(MgOWNERCONDP(mg), MgMUTEXP(mg));
            MgOWNER(mg) = thr;
+           DEBUG_L(PerlIO_printf(PerlIO_stderr(),
+                                 "0x%lx: pp_entersub lock 0x%lx\n",
+                                 (unsigned long)thr, (unsigned long)sv);)
            MUTEX_UNLOCK(MgMUTEXP(mg));
            save_destructor(unlock_condpair, sv);
        }
diff --git a/util.c b/util.c
index 8fa30a0..6fc5672 100644 (file)
--- a/util.c
+++ b/util.c
@@ -2422,6 +2422,10 @@ SV *sv;
            mg->mg_ptr = (char *)cp;
            mg->mg_len = sizeof(cp);
            MUTEX_UNLOCK(&sv_mutex);
+           DEBUG_L(WITH_THR(PerlIO_printf(PerlIO_stderr(),
+                                          "0x%lx: condpair_magic 0x%lx\n",
+                                          (unsigned long)thr,
+                                          (unsigned long)sv));)
        }
     }
     return mg;