investigate_timeouts
author Alon Zakai <azakai@mozilla.com>
Wed, 08 Sep 2010 18:17:12 -0700
changeset 206 f9b5104b9db6
parent 205 b29a560d769f
child 207 4d3736ac8444
permissions -rw-r--r--
timeouts
diff --git a/js/src/jslock.cpp b/js/src/jslock.cpp
--- a/js/src/jslock.cpp
+++ b/js/src/jslock.cpp
@@ -618,7 +618,7 @@
 #ifdef DEBUG
         PRStatus stat =
 #endif
-            PR_WaitCondVar(rt->titleSharingDone, PR_INTERVAL_NO_TIMEOUT);
+            PR_WaitCondVar("./js/src/jslock.cpp:621", rt->titleSharingDone, PR_INTERVAL_NO_TIMEOUT);
         JS_ASSERT(stat != PR_FAILURE);
         cx->thread->titleToShare = NULL;
     }
@@ -1041,7 +1041,7 @@
     fl->susp++;
     PR_Lock(fl->slock);
     js_UnlockGlobal(tl);
-    stat = PR_WaitCondVar(fl->svar, PR_INTERVAL_NO_TIMEOUT);
+    stat = PR_WaitCondVar("./js/src/jslock.cpp:1044", fl->svar, PR_INTERVAL_NO_TIMEOUT);
     JS_ASSERT(stat != PR_FAILURE);
     PR_Unlock(fl->slock);
     js_LockGlobal(tl);
diff --git a/js/src/jslock.h b/js/src/jslock.h
--- a/js/src/jslock.h
+++ b/js/src/jslock.h
@@ -126,7 +126,7 @@
 
 #define JS_NEW_CONDVAR(l)           PR_NewCondVar(l)
 #define JS_DESTROY_CONDVAR(cv)      PR_DestroyCondVar(cv)
-#define JS_WAIT_CONDVAR(cv,to)      PR_WaitCondVar(cv,to)
+#define JS_WAIT_CONDVAR(cv,to)      PR_WaitCondVar("JS Engine",cv,to)
 #define JS_NO_TIMEOUT               PR_INTERVAL_NO_TIMEOUT
 #define JS_NOTIFY_CONDVAR(cv)       PR_NotifyCondVar(cv)
 #define JS_NOTIFY_ALL_CONDVAR(cv)   PR_NotifyAllCondVar(cv)
diff --git a/js/src/jstask.cpp b/js/src/jstask.cpp
--- a/js/src/jstask.cpp
+++ b/js/src/jstask.cpp
@@ -92,7 +92,7 @@
 {
     PR_Lock(lock);
     while (!shutdown) {
-        PR_WaitCondVar(wakeup, PR_INTERVAL_NO_TIMEOUT);
+        PR_WaitCondVar("./js/src/jstask.cpp:95", wakeup, PR_INTERVAL_NO_TIMEOUT);
         JSBackgroundTask* t;
         while ((t = stack) != NULL) {
             stack = t->next;
diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -3205,7 +3205,7 @@
         PR_Lock(gWatchdogLock);
         PRIntervalTime to_wakeup = PR_IntervalNow() + t_ticks;
         for (;;) {
-            PR_WaitCondVar(gSleepWakeup, t_ticks);
+            PR_WaitCondVar("./js/src/shell/js.cpp:3208", gSleepWakeup, t_ticks);
             if (gCanceled)
                 break;
             PRIntervalTime now = PR_IntervalNow();
@@ -3272,7 +3272,7 @@
     /* Wait for our signal. */
     PR_Lock(td->shared->lock);
     while ((st = td->shared->status) == SCATTER_WAIT)
-        PR_WaitCondVar(td->shared->cvar, PR_INTERVAL_NO_TIMEOUT);
+        PR_WaitCondVar("./js/src/shell/js.cpp:3275", td->shared->cvar, PR_INTERVAL_NO_TIMEOUT);
     PR_Unlock(td->shared->lock);
 
     if (st == SCATTER_CANCEL)
@@ -3525,7 +3525,7 @@
 #ifdef DEBUG
             PRStatus status =
 #endif
-                PR_WaitCondVar(gWatchdogWakeup, sleepDuration);
+                PR_WaitCondVar("./js/src/shell/js.cpp:3528", gWatchdogWakeup, sleepDuration);
             JS_ASSERT(status == PR_SUCCESS);
         }
     }
diff --git a/js/src/xpconnect/src/xpcjsruntime.cpp b/js/src/xpconnect/src/xpcjsruntime.cpp
--- a/js/src/xpconnect/src/xpcjsruntime.cpp
+++ b/js/src/xpconnect/src/xpcjsruntime.cpp
@@ -817,7 +817,7 @@
 #ifdef DEBUG
         PRStatus status =
 #endif
-            PR_WaitCondVar(self->mWatchdogWakeup, sleepInterval);
+            PR_WaitCondVar("./js/src/xpconnect/src/xpcjsruntime.cpp:820", self->mWatchdogWakeup, sleepInterval);
         JS_ASSERT(status == PR_SUCCESS);
         JSContext* cx = nsnull;
         while((cx = js_NextActiveContext(self->mJSRuntime, cx)))
@@ -907,7 +907,7 @@
             if (mWatchdogThread) {
                 mWatchdogThread = nsnull;
                 PR_NotifyCondVar(mWatchdogWakeup);
-                PR_WaitCondVar(mWatchdogWakeup, PR_INTERVAL_NO_TIMEOUT);
+                PR_WaitCondVar("./js/src/xpconnect/src/xpcjsruntime.cpp:910", mWatchdogWakeup, PR_INTERVAL_NO_TIMEOUT);
             }
         }
         PR_DestroyCondVar(mWatchdogWakeup);
diff --git a/netwerk/base/src/nsIOThreadPool.cpp b/netwerk/base/src/nsIOThreadPool.cpp
--- a/netwerk/base/src/nsIOThreadPool.cpp
+++ b/netwerk/base/src/nsIOThreadPool.cpp
@@ -162,7 +162,7 @@
         PR_NotifyAllCondVar(mIdleThreadCV);
 
         while (mNumThreads != 0)
-            PR_WaitCondVar(mExitThreadCV, PR_INTERVAL_NO_TIMEOUT);
+            PR_WaitCondVar("./netwerk/base/src/nsIOThreadPool.cpp:165", mExitThreadCV, PR_INTERVAL_NO_TIMEOUT);
     }
 }
 
@@ -251,7 +251,7 @@
             //
             while (PR_CLIST_IS_EMPTY(&pool->mEventQ) && !pool->mShutdown) {
                 pool->mNumIdleThreads++;
-                PR_WaitCondVar(pool->mIdleThreadCV, timeout);
+                PR_WaitCondVar("./netwerk/base/src/nsIOThreadPool.cpp:254", pool->mIdleThreadCV, timeout);
                 pool->mNumIdleThreads--;
 
                 PRIntervalTime delta = PR_IntervalNow() - start;
diff --git a/netwerk/cache/nsCacheRequest.h b/netwerk/cache/nsCacheRequest.h
--- a/netwerk/cache/nsCacheRequest.h
+++ b/netwerk/cache/nsCacheRequest.h
@@ -166,7 +166,7 @@
         PRStatus status = PR_SUCCESS;
         PR_Lock(mLock);
         while (WaitingForValidation() && (status == PR_SUCCESS) ) {
-            status = PR_WaitCondVar(mCondVar, PR_INTERVAL_NO_TIMEOUT);
+            status = PR_WaitCondVar("nsCacheRequest", mCondVar, PR_INTERVAL_NO_TIMEOUT);
         }
         MarkWaitingForValidation();  // set up for next time
         PR_Unlock(mLock);
diff --git a/netwerk/dns/nsHostResolver.cpp b/netwerk/dns/nsHostResolver.cpp
--- a/netwerk/dns/nsHostResolver.cpp
+++ b/netwerk/dns/nsHostResolver.cpp
@@ -774,7 +774,7 @@
         //  (3) the thread has been idle for too long
         
         mNumIdleThreads++;
-        PR_WaitCondVar(mIdleThreadCV, timeout);
+        PR_WaitCondVar("./netwerk/dns/nsHostResolver.cpp:777", mIdleThreadCV, timeout);
         mNumIdleThreads--;
         
         now = PR_IntervalNow();
@@ -782,7 +782,7 @@
         if ((PRIntervalTime)(now - epoch) >= timeout)
             timedOut = PR_TRUE;
         else {
-            // It is possible that PR_WaitCondVar() was interrupted and returned early,
+            // It is possible that PR_WaitCondVar("./netwerk/dns/nsHostResolver.cpp:785", ) was interrupted and returned early,
             // in which case we will loop back and re-enter it. In that case we want to
             // do so with the new timeout reduced to reflect time already spent waiting.
             timeout -= (PRIntervalTime)(now - epoch);
diff --git a/nsprpub/pr/include/prcvar.h b/nsprpub/pr/include/prcvar.h
--- a/nsprpub/pr/include/prcvar.h
+++ b/nsprpub/pr/include/prcvar.h
@@ -94,7 +94,7 @@
 ** with the condition variable or the thread was interrupted (PR_Interrupt()).
 ** The particular reason can be extracted with PR_GetError().
 */
-NSPR_API(PRStatus) PR_WaitCondVar(PRCondVar *cvar, PRIntervalTime timeout);
+NSPR_API(PRStatus) PR_WaitCondVar(char* src, PRCondVar *cvar, PRIntervalTime timeout);
 
 /*
 ** Notify ONE thread that is currently waiting on 'cvar'. Which thread is
diff --git a/nsprpub/pr/src/bthreads/btmon.c b/nsprpub/pr/src/bthreads/btmon.c
--- a/nsprpub/pr/src/bthreads/btmon.c
+++ b/nsprpub/pr/src/bthreads/btmon.c
@@ -170,7 +170,7 @@
     entryCount = mon->entryCount;
     mon->entryCount = 0;
 
-    status = PR_WaitCondVar( mon->cvar, ticks );
+    status = PR_WaitCondVar("./nsprpub/pr/src/bthreads/btmon.c:173",  mon->cvar, ticks );
 
     mon->entryCount = entryCount;
 
diff --git a/nsprpub/pr/src/cplus/rccv.cpp b/nsprpub/pr/src/cplus/rccv.cpp
--- a/nsprpub/pr/src/cplus/rccv.cpp
+++ b/nsprpub/pr/src/cplus/rccv.cpp
@@ -67,7 +67,7 @@
         rv = PR_FAILURE;
     }
     else
-        rv = PR_WaitCondVar(cv, timeout.interval);
+        rv = PR_WaitCondVar("./nsprpub/pr/src/cplus/rccv.cpp:70", cv, timeout.interval);
     return rv;
 }  /* RCCondition::Wait */
 
diff --git a/nsprpub/pr/src/io/prfile.c b/nsprpub/pr/src/io/prfile.c
--- a/nsprpub/pr/src/io/prfile.c
+++ b/nsprpub/pr/src/io/prfile.c
@@ -627,7 +627,7 @@
 
     PR_Lock(_pr_flock_lock);
     while (fd->secret->lockCount == -1)
-        PR_WaitCondVar(_pr_flock_cv, PR_INTERVAL_NO_TIMEOUT);
+        PR_WaitCondVar("./nsprpub/pr/src/io/prfile.c:630", _pr_flock_cv, PR_INTERVAL_NO_TIMEOUT);
     if (fd->secret->lockCount == 0) {
         fd->secret->lockCount = -1;
         PR_Unlock(_pr_flock_lock);
diff --git a/nsprpub/pr/src/io/prmwait.c b/nsprpub/pr/src/io/prmwait.c
--- a/nsprpub/pr/src/io/prmwait.c
+++ b/nsprpub/pr/src/io/prmwait.c
@@ -84,7 +84,7 @@
     {
         if (PR_CLIST_IS_EMPTY(&tm_vars.timer_queue))
         {
-            PR_WaitCondVar(tm_vars.new_timer, PR_INTERVAL_NO_TIMEOUT);
+            PR_WaitCondVar("./nsprpub/pr/src/io/prmwait.c:87", tm_vars.new_timer, PR_INTERVAL_NO_TIMEOUT);
         }
         else
         {
@@ -112,7 +112,7 @@
             else
             {
                 timeout = (PRIntervalTime)(timer->absolute - now);
-                PR_WaitCondVar(tm_vars.new_timer, timeout);
+                PR_WaitCondVar("./nsprpub/pr/src/io/prmwait.c:115", tm_vars.new_timer, timeout);
             } 
         }
     }
@@ -165,7 +165,7 @@
     {
         while (timer->ref_count == 1)
         {
-            PR_WaitCondVar(tm_vars.cancel_timer, PR_INTERVAL_NO_TIMEOUT);
+            PR_WaitCondVar("./nsprpub/pr/src/io/prmwait.c:168", tm_vars.cancel_timer, PR_INTERVAL_NO_TIMEOUT);
         }
     }
     else
@@ -473,7 +473,7 @@
         while (0 == group->waiter->count)
         {
             PRStatus st;
-            st = PR_WaitCondVar(group->new_business, PR_INTERVAL_NO_TIMEOUT);
+            st = PR_WaitCondVar("./nsprpub/pr/src/io/prmwait.c:476", group->new_business, PR_INTERVAL_NO_TIMEOUT);
             if (_prmw_running != group->state)
             {
                 PR_SetError(PR_INVALID_STATE_ERROR, 0);
@@ -967,7 +967,7 @@
                 PRStatus st;
                 do 
                 {
-                    st = PR_WaitCondVar(group->io_complete, PR_INTERVAL_NO_TIMEOUT);
+                    st = PR_WaitCondVar("./nsprpub/pr/src/io/prmwait.c:970", group->io_complete, PR_INTERVAL_NO_TIMEOUT);
                     if (_prmw_running != group->state)
                     {
                         PR_SetError(PR_INVALID_STATE_ERROR, 0);
@@ -1172,7 +1172,7 @@
             PR_NotifyAllCondVar(group->io_complete);
         }
         while (_prmw_stopped != group->state)
-            (void)PR_WaitCondVar(group->mw_manage, PR_INTERVAL_NO_TIMEOUT);
+            (void)PR_WaitCondVar("./nsprpub/pr/src/io/prmwait.c:1175", group->mw_manage, PR_INTERVAL_NO_TIMEOUT);
     }
 
 #ifdef WINNT
diff --git a/nsprpub/pr/src/md/unix/uxproces.c b/nsprpub/pr/src/md/unix/uxproces.c
--- a/nsprpub/pr/src/md/unix/uxproces.c
+++ b/nsprpub/pr/src/md/unix/uxproces.c
@@ -420,7 +420,7 @@
     } while (-1 == rv && EINTR == errno);
 
     while (op->done == PR_FALSE) {
-	PR_WaitCondVar(op->doneCV, PR_INTERVAL_NO_TIMEOUT);
+	PR_WaitCondVar("./nsprpub/pr/src/md/unix/uxproces.c:423", op->doneCV, PR_INTERVAL_NO_TIMEOUT);
     }
     PR_Unlock(pr_wp.ml);
     PR_DestroyCondVar(op->doneCV);
@@ -571,7 +571,7 @@
     while (1) {
         PR_Lock(pr_wp.ml);
         while (0 == pr_wp.numProcs) {
-            PR_WaitCondVar(pr_wp.cv, PR_INTERVAL_NO_TIMEOUT);
+            PR_WaitCondVar("./nsprpub/pr/src/md/unix/uxproces.c:574", pr_wp.cv, PR_INTERVAL_NO_TIMEOUT);
         }
         PR_Unlock(pr_wp.ml);
 
@@ -600,7 +600,7 @@
             ProcessReapedChildInternal(pid, status);
             pr_wp.numProcs--;
             while (0 == pr_wp.numProcs) {
-                PR_WaitCondVar(pr_wp.cv, PR_INTERVAL_NO_TIMEOUT);
+                PR_WaitCondVar("./nsprpub/pr/src/md/unix/uxproces.c:603", pr_wp.cv, PR_INTERVAL_NO_TIMEOUT);
             }
 	    PR_Unlock(pr_wp.ml);
 	}
@@ -848,7 +848,7 @@
 	}
 	InsertPidTable(pRec);
 	while (!interrupted && _PR_PID_REAPED != pRec->state) {
-	    if (PR_WaitCondVar(pRec->reapedCV,
+	    if (PR_WaitCondVar("./nsprpub/pr/src/md/unix/uxproces.c:851", pRec->reapedCV,
 		    PR_INTERVAL_NO_TIMEOUT) == PR_FAILURE
 		    && PR_GetError() == PR_PENDING_INTERRUPT_ERROR) {
 		interrupted = PR_TRUE;
diff --git a/nsprpub/pr/src/md/windows/ntio.c b/nsprpub/pr/src/md/windows/ntio.c
--- a/nsprpub/pr/src/md/windows/ntio.c
+++ b/nsprpub/pr/src/md/windows/ntio.c
@@ -4295,7 +4295,7 @@
         PR_Lock(pt_tq.ml);
         while (NULL == pt_tq.head)
         {
-            status = PR_WaitCondVar(pt_tq.new_op, PR_INTERVAL_NO_TIMEOUT);
+            status = PR_WaitCondVar("./nsprpub/pr/src/md/windows/ntio.c:4298", pt_tq.new_op, PR_INTERVAL_NO_TIMEOUT);
             if ((PR_FAILURE == status)
                 && (PR_PENDING_INTERRUPT_ERROR == PR_GetError())) break;
         }
@@ -4514,7 +4514,7 @@
 
     while (pt_continuation_done != op->status)  /* wait for completion */
     {
-        rv = PR_WaitCondVar(op->complete, PR_INTERVAL_NO_TIMEOUT);
+        rv = PR_WaitCondVar("./nsprpub/pr/src/md/windows/ntio.c:4517", op->complete, PR_INTERVAL_NO_TIMEOUT);
         /*
          * If we get interrupted, we set state the continuation thread will
          * see and allow it to finish the I/O operation w/ error. That way
diff --git a/nsprpub/pr/src/misc/pralarm.c b/nsprpub/pr/src/misc/pralarm.c
--- a/nsprpub/pr/src/misc/pralarm.c
+++ b/nsprpub/pr/src/misc/pralarm.c
@@ -144,7 +144,7 @@
             {
                 id = pr_getNextAlarm(alarm, id);  /* even if it's the same */
                 if (id == NULL)  /* there are no alarms set */
-                    (void)PR_WaitCondVar(alarm->cond, PR_INTERVAL_NO_TIMEOUT);
+                    (void)PR_WaitCondVar("./nsprpub/pr/src/misc/pralarm.c:147", alarm->cond, PR_INTERVAL_NO_TIMEOUT);
                 else
                 {
                     pause = id->nextNotify - (PR_IntervalNow() - id->epoch);
@@ -154,7 +154,7 @@
                         alarm->current = id;  /* id we're about to schedule */
                     }
                     else
-                        (void)PR_WaitCondVar(alarm->cond, pause);  /* dally */
+                        (void)PR_WaitCondVar("./nsprpub/pr/src/misc/pralarm.c:157", alarm->cond, pause);  /* dally */
                 }
             }
         }
diff --git a/nsprpub/pr/src/misc/prinit.c b/nsprpub/pr/src/misc/prinit.c
--- a/nsprpub/pr/src/misc/prinit.c
+++ b/nsprpub/pr/src/misc/prinit.c
@@ -392,7 +392,7 @@
          */
         PR_Lock(_pr_activeLock);
         while (_pr_userActive > _pr_primordialExitCount) {
-            PR_WaitCondVar(_pr_primordialExitCVar, PR_INTERVAL_NO_TIMEOUT);
+            PR_WaitCondVar("./nsprpub/pr/src/misc/prinit.c:395", _pr_primordialExitCVar, PR_INTERVAL_NO_TIMEOUT);
         }
         if (me->flags & _PR_SYSTEM) {
             _pr_systemActive--;
@@ -812,7 +812,7 @@
 	} else {
 	    PR_Lock(mod_init.ml);
 	    while (!once->initialized) {
-		PR_WaitCondVar(mod_init.cv, PR_INTERVAL_NO_TIMEOUT);
+		PR_WaitCondVar("./nsprpub/pr/src/misc/prinit.c:815", mod_init.cv, PR_INTERVAL_NO_TIMEOUT);
             }
 	    PR_Unlock(mod_init.ml);
 	}
@@ -841,7 +841,7 @@
 	} else {
 	    PR_Lock(mod_init.ml);
 	    while (!once->initialized) {
-		PR_WaitCondVar(mod_init.cv, PR_INTERVAL_NO_TIMEOUT);
+		PR_WaitCondVar("./nsprpub/pr/src/misc/prinit.c:844", mod_init.cv, PR_INTERVAL_NO_TIMEOUT);
             }
 	    PR_Unlock(mod_init.ml);
 	}
diff --git a/nsprpub/pr/src/misc/prtpool.c b/nsprpub/pr/src/misc/prtpool.c
--- a/nsprpub/pr/src/misc/prtpool.c
+++ b/nsprpub/pr/src/misc/prtpool.c
@@ -220,7 +220,7 @@
 		PR_Lock(tp->jobq.lock);
 		while (PR_CLIST_IS_EMPTY(&tp->jobq.list) && (!tp->shutdown)) {
 			tp->idle_threads++;
-			PR_WaitCondVar(tp->jobq.cv, PR_INTERVAL_NO_TIMEOUT);
+			PR_WaitCondVar("./nsprpub/pr/src/misc/prtpool.c:223", tp->jobq.cv, PR_INTERVAL_NO_TIMEOUT);
 			tp->idle_threads--;
 		}	
 		if (tp->shutdown) {
@@ -542,7 +542,7 @@
 				timeout = PR_INTERVAL_NO_WAIT;  /* already timed out */
 		}
 		if (PR_INTERVAL_NO_WAIT != timeout)
-			PR_WaitCondVar(tp->timerq.cv, timeout);
+			PR_WaitCondVar("./nsprpub/pr/src/misc/prtpool.c:545", tp->timerq.cv, timeout);
 		if (tp->shutdown) {
 			PR_Unlock(tp->timerq.lock);
 			break;
@@ -1047,7 +1047,7 @@
 			notify_ioq(tp);
 			PR_Lock(tp->ioq.lock);
 			while (jobp->cancel_io)
-				PR_WaitCondVar(jobp->cancel_cv, PR_INTERVAL_NO_TIMEOUT);
+				PR_WaitCondVar("./nsprpub/pr/src/misc/prtpool.c:1050", jobp->cancel_cv, PR_INTERVAL_NO_TIMEOUT);
 			PR_Unlock(tp->ioq.lock);
 			PR_ASSERT(!jobp->on_ioq);
 			if (!JOINABLE_JOB(jobp)) {
@@ -1074,7 +1074,7 @@
 	}
 	PR_Lock(jobp->tpool->join_lock);
 	while(jobp->join_wait)
-		PR_WaitCondVar(jobp->join_cv, PR_INTERVAL_NO_TIMEOUT);
+		PR_WaitCondVar("./nsprpub/pr/src/misc/prtpool.c:1077", jobp->join_cv, PR_INTERVAL_NO_TIMEOUT);
 	PR_Unlock(jobp->tpool->join_lock);
 	delete_job(jobp);
 	return PR_SUCCESS;
@@ -1108,7 +1108,7 @@
 
 	PR_Lock(tpool->jobq.lock);
 	while (!tpool->shutdown)
-		PR_WaitCondVar(tpool->shutdown_cv, PR_INTERVAL_NO_TIMEOUT);
+		PR_WaitCondVar("./nsprpub/pr/src/misc/prtpool.c:1111", tpool->shutdown_cv, PR_INTERVAL_NO_TIMEOUT);
 
 	/*
 	 * wakeup worker threads
diff --git a/nsprpub/pr/src/misc/prtrace.c b/nsprpub/pr/src/misc/prtrace.c
--- a/nsprpub/pr/src/misc/prtrace.c
+++ b/nsprpub/pr/src/misc/prtrace.c
@@ -809,7 +809,7 @@
         PR_Lock( logLock );
 
         while ( (logCount == 0) && ( logOrder == logState ) )
-            PR_WaitCondVar( logCVar, PR_INTERVAL_NO_TIMEOUT );
+            PR_WaitCondVar("./nsprpub/pr/src/misc/prtrace.c:812",  logCVar, PR_INTERVAL_NO_TIMEOUT );
 
         /* Handle state transitions */
         if ( logOrder != logState )
diff --git a/nsprpub/pr/src/pthreads/ptio.c b/nsprpub/pr/src/pthreads/ptio.c
--- a/nsprpub/pr/src/pthreads/ptio.c
+++ b/nsprpub/pr/src/pthreads/ptio.c
@@ -4641,7 +4641,7 @@
 
     PR_Lock(_pr_flock_lock);
     while (-1 == fd->secret->lockCount)
-        PR_WaitCondVar(_pr_flock_cv, PR_INTERVAL_NO_TIMEOUT);
+        PR_WaitCondVar("./nsprpub/pr/src/pthreads/ptio.c:4644", _pr_flock_cv, PR_INTERVAL_NO_TIMEOUT);
     if (0 == fd->secret->lockCount)
     {
         fd->secret->lockCount = -1;
diff --git a/nsprpub/pr/src/pthreads/ptsynch.c b/nsprpub/pr/src/pthreads/ptsynch.c
--- a/nsprpub/pr/src/pthreads/ptsynch.c
+++ b/nsprpub/pr/src/pthreads/ptsynch.c
@@ -378,8 +378,14 @@
     }
 }  /* PR_DestroyCondVar */
 
-PR_IMPLEMENT(PRStatus) PR_WaitCondVar(PRCondVar *cvar, PRIntervalTime timeout)
+PR_IMPLEMENT(PRStatus) PR_WaitCondVar(char *src, PRCondVar *cvar, PRIntervalTime timeout)
 {
+    static PRIntervalTime lastTime = 0;
+    if (lastTime > 0 && timeout != PR_INTERVAL_NO_WAIT) {
+        printf("WaitCondVar: %s (%.6f seconds since previous; timeout: %d)\n", src, PR_IntervalToMilliseconds(PR_IntervalNow()-lastTime)/1000.0, timeout == PR_INTERVAL_NO_TIMEOUT ? -1 : timeout);
+    }
+    lastTime = PR_IntervalNow();
+
     PRIntn rv;
     PRThread *thred = PR_GetCurrentThread();
 
@@ -611,7 +617,7 @@
     _PT_PTHREAD_COPY_THR_HANDLE(mon->owner, saved_owner);
     _PT_PTHREAD_INVALIDATE_THR_HANDLE(mon->owner);
     
-    rv = PR_WaitCondVar(mon->cvar, timeout);
+    rv = PR_WaitCondVar("WAIT", mon->cvar, timeout);
 
     /* reinstate the intresting information */
     mon->entryCount = saved_entries;
@@ -674,7 +680,7 @@
         "PR_WaitSem", "locks & condition variables");
 	PR_Lock(semaphore->cvar->lock);
 	while ((semaphore->count == 0) && (PR_SUCCESS == status))
-		status = PR_WaitCondVar(semaphore->cvar, PR_INTERVAL_NO_TIMEOUT);
+		status = PR_WaitCondVar("WaitSem", semaphore->cvar, PR_INTERVAL_NO_TIMEOUT);
 	if (PR_SUCCESS == status) semaphore->count -= 1;
 	PR_Unlock(semaphore->cvar->lock);
 	return status;
diff --git a/nsprpub/pr/src/pthreads/ptthread.c b/nsprpub/pr/src/pthreads/ptthread.c
--- a/nsprpub/pr/src/pthreads/ptthread.c
+++ b/nsprpub/pr/src/pthreads/ptthread.c
@@ -237,7 +237,7 @@
     if (detached)
     {
         while (!thred->okToDelete)
-            PR_WaitCondVar(pt_book.cv, PR_INTERVAL_NO_TIMEOUT);
+            PR_WaitCondVar("./nsprpub/pr/src/pthreads/ptthread.c:240", pt_book.cv, PR_INTERVAL_NO_TIMEOUT);
     }
 
     if (thred->state & PT_THREAD_SYSTEM)
@@ -811,7 +811,7 @@
             PRIntervalTime now = PR_IntervalNow();
             PRIntervalTime delta = now - timein;
             if (delta > ticks) break;
-            rv = PR_WaitCondVar(cv, ticks - delta);
+            rv = PR_WaitCondVar("./nsprpub/pr/src/pthreads/ptthread.c:814", cv, ticks - delta);
         } while (PR_SUCCESS == rv);
         PR_Unlock(_pr_sleeplock);
         PR_DestroyCondVar(cv);
@@ -1039,7 +1039,7 @@
     {
         PR_Lock(pt_book.ml);
         while (pt_book.user > pt_book.this_many)
-            PR_WaitCondVar(pt_book.cv, PR_INTERVAL_NO_TIMEOUT);
+            PR_WaitCondVar("./nsprpub/pr/src/pthreads/ptthread.c:1042", pt_book.cv, PR_INTERVAL_NO_TIMEOUT);
         if (me->state & PT_THREAD_SYSTEM)
             pt_book.system -= 1;
         else
diff --git a/nsprpub/pr/src/threads/combined/prucv.c b/nsprpub/pr/src/threads/combined/prucv.c
--- a/nsprpub/pr/src/threads/combined/prucv.c
+++ b/nsprpub/pr/src/threads/combined/prucv.c
@@ -536,7 +536,7 @@
 ** with the condition variable or the thread has been interrupted.
 */
 extern PRThread *suspendAllThread;
-PR_IMPLEMENT(PRStatus) PR_WaitCondVar(PRCondVar *cvar, PRIntervalTime timeout)
+PR_IMPLEMENT(PRStatus) PR_WaitCondVar(char* src, PRCondVar *cvar, PRIntervalTime timeout)
 {
     PRThread *me = _PR_MD_CURRENT_THREAD();
 
diff --git a/nsprpub/pr/src/threads/combined/pruthr.c b/nsprpub/pr/src/threads/combined/pruthr.c
--- a/nsprpub/pr/src/threads/combined/pruthr.c
+++ b/nsprpub/pr/src/threads/combined/pruthr.c
@@ -1567,7 +1567,7 @@
     /* wait for the target thread's termination cv invariant */
     PR_Lock (_pr_terminationCVLock);
     while (thread->state != _PR_JOIN_WAIT) {
-        (void) PR_WaitCondVar(term, PR_INTERVAL_NO_TIMEOUT);
+        (void) PR_WaitCondVar("./nsprpub/pr/src/threads/combined/pruthr.c:1570", term, PR_INTERVAL_NO_TIMEOUT);
     }
     (void) PR_Unlock (_pr_terminationCVLock);
     
diff --git a/nsprpub/pr/src/threads/prcthr.c b/nsprpub/pr/src/threads/prcthr.c
--- a/nsprpub/pr/src/threads/prcthr.c
+++ b/nsprpub/pr/src/threads/prcthr.c
@@ -150,7 +150,7 @@
         {
             PRIntervalTime delta = PR_IntervalNow() - timein;
             if (delta > timeout) break;
-            rv = PR_WaitCondVar(cv, timeout - delta);
+            rv = PR_WaitCondVar("./nsprpub/pr/src/threads/prcthr.c:153", cv, timeout - delta);
         } while (rv == PR_SUCCESS);
         PR_Unlock(_pr_sleeplock);
         PR_DestroyCondVar(cv);
diff --git a/nsprpub/pr/src/threads/prrwlock.c b/nsprpub/pr/src/threads/prrwlock.c
--- a/nsprpub/pr/src/threads/prrwlock.c
+++ b/nsprpub/pr/src/threads/prrwlock.c
@@ -243,7 +243,7 @@
 	while ((rwlock->rw_lock_cnt < 0) ||
 			(rwlock->rw_writer_cnt > 0)) {
 		rwlock->rw_reader_cnt++;
-		PR_WaitCondVar(rwlock->rw_reader_waitq, PR_INTERVAL_NO_TIMEOUT);
+		PR_WaitCondVar("./nsprpub/pr/src/threads/prrwlock.c:246", rwlock->rw_reader_waitq, PR_INTERVAL_NO_TIMEOUT);
 		rwlock->rw_reader_cnt--;
 	}
 	/*
@@ -295,7 +295,7 @@
 	 */
 	while (rwlock->rw_lock_cnt != 0) {
 		rwlock->rw_writer_cnt++;
-		PR_WaitCondVar(rwlock->rw_writer_waitq, PR_INTERVAL_NO_TIMEOUT);
+		PR_WaitCondVar("./nsprpub/pr/src/threads/prrwlock.c:298", rwlock->rw_writer_waitq, PR_INTERVAL_NO_TIMEOUT);
 		rwlock->rw_writer_cnt--;
 	}
 	/*
diff --git a/nsprpub/pr/src/threads/prsem.c b/nsprpub/pr/src/threads/prsem.c
--- a/nsprpub/pr/src/threads/prsem.c
+++ b/nsprpub/pr/src/threads/prsem.c
@@ -115,7 +115,7 @@
 	PR_Lock(sem->cvar->lock);
 	while (sem->count == 0) {
 		sem->waiters++;
-		status = PR_WaitCondVar(sem->cvar, PR_INTERVAL_NO_TIMEOUT);
+		status = PR_WaitCondVar("./nsprpub/pr/src/threads/prsem.c:118", sem->cvar, PR_INTERVAL_NO_TIMEOUT);
 		sem->waiters--;
 		if (status != PR_SUCCESS)
 			break;
diff --git a/nsprpub/pr/tests/alarm.c b/nsprpub/pr/tests/alarm.c
--- a/nsprpub/pr/tests/alarm.c
+++ b/nsprpub/pr/tests/alarm.c
@@ -93,7 +93,7 @@
     while (notifyData->counter > 0)
     {
         while (!notifyData->pending)
-            PR_WaitCondVar(notifyData->child, PR_INTERVAL_NO_TIMEOUT);
+            PR_WaitCondVar("./nsprpub/pr/tests/alarm.c:96", notifyData->child, PR_INTERVAL_NO_TIMEOUT);
         notifyData->counter -= 1;
         notifyData->pending = PR_FALSE;
         PR_NotifyCondVar(notifyData->parent);
@@ -142,7 +142,7 @@
         notifyData.pending = PR_TRUE;
         PR_NotifyCondVar(notifyData.child);
         while (notifyData.pending)
-            PR_WaitCondVar(notifyData.parent, PR_INTERVAL_NO_TIMEOUT);
+            PR_WaitCondVar("./nsprpub/pr/tests/alarm.c:145", notifyData.parent, PR_INTERVAL_NO_TIMEOUT);
     }
     PR_Unlock(notifyData.ml);
 
@@ -173,7 +173,7 @@
     for (count = 0; count < loops; ++count)
     {
         overhead += interval;
-        PR_ASSERT(PR_WaitCondVar(cv, interval) == PR_SUCCESS);
+        PR_ASSERT(PR_WaitCondVar("./nsprpub/pr/tests/alarm.c:176", cv, interval) == PR_SUCCESS);
     }
     PR_Unlock(ml);
 
@@ -212,7 +212,7 @@
     if (!late && (interval > 10))
     {
         interval &= (now & 0x03) + 1;
-        PR_WaitCondVar(ad->cv, interval);
+        PR_WaitCondVar("./nsprpub/pr/tests/alarm.c:215", ad->cv, interval);
     }
           
     PR_Unlock(ad->ml);
@@ -272,7 +272,7 @@
 
     PR_Lock(ml);
     while ((PRIntervalTime)(PR_IntervalNow() - ad.timein) < duration)
-        PR_WaitCondVar(cv, PR_INTERVAL_NO_TIMEOUT);
+        PR_WaitCondVar("./nsprpub/pr/tests/alarm.c:275", cv, PR_INTERVAL_NO_TIMEOUT);
     PR_Unlock(ml);
 
     timein = PR_IntervalNow();
@@ -300,7 +300,7 @@
     if (!late && (interval > 10))
     {
         interval &= (now & 0x03) + 1;
-        PR_WaitCondVar(ad->cv, interval);
+        PR_WaitCondVar("./nsprpub/pr/tests/alarm.c:303", ad->cv, interval);
     }
 
     if (!keepGoing) rv = PR_NotifyCondVar(ad->cv);
@@ -343,7 +343,7 @@
 
     PR_Lock(ml);
     while ((PRIntervalTime)(PR_IntervalNow() - ad.timein) < duration)
-        PR_WaitCondVar(cv, PR_INTERVAL_NO_TIMEOUT);
+        PR_WaitCondVar("./nsprpub/pr/tests/alarm.c:346", cv, PR_INTERVAL_NO_TIMEOUT);
     PR_Unlock(ml);
     
     timein = PR_IntervalNow();
@@ -409,7 +409,7 @@
     for (i = 0; i < 3; ++i)
     {
         while ((PRIntervalTime)(PR_IntervalNow() - ad[i].timein) < duration)
-            PR_WaitCondVar(cv, PR_INTERVAL_NO_TIMEOUT);
+            PR_WaitCondVar("./nsprpub/pr/tests/alarm.c:412", cv, PR_INTERVAL_NO_TIMEOUT);
     }
     PR_Unlock(ml);
 
diff --git a/nsprpub/pr/tests/cltsrv.c b/nsprpub/pr/tests/cltsrv.c
--- a/nsprpub/pr/tests/cltsrv.c
+++ b/nsprpub/pr/tests/cltsrv.c
@@ -375,7 +375,7 @@
         PR_Lock(client->ml);
         client->operations += 1;
         client->bytesTransferred += 2 * descbytes;
-        rv = PR_WaitCondVar(client->stateChange, rand() % clipping);
+        rv = PR_WaitCondVar("./nsprpub/pr/tests/cltsrv.c:378", client->stateChange, rand() % clipping);
         PR_Unlock(client->ml);
         if (Aborted(rv)) break;
     }
@@ -680,7 +680,7 @@
                 cltsrv_log_file, TEST_LOG_VERBOSE,
                 ("\t\tWorker(0x%p): waiting for accept slot[%d]\n",
                 me, pool->accepting));
-            rv = PR_WaitCondVar(pool->acceptComplete, PR_INTERVAL_NO_TIMEOUT);
+            rv = PR_WaitCondVar("./nsprpub/pr/tests/cltsrv.c:683", pool->acceptComplete, PR_INTERVAL_NO_TIMEOUT);
             if (Aborted(rv) || (cs_run != server->state))
             {
                 TEST_LOG(
@@ -824,7 +824,7 @@
     PR_Lock(server->ml);
     while ((cs_run == server->state) && !Aborted(rv))
     {
-        rv = PR_WaitCondVar(server->stateChange, PR_INTERVAL_NO_TIMEOUT);
+        rv = PR_WaitCondVar("./nsprpub/pr/tests/cltsrv.c:827", server->stateChange, PR_INTERVAL_NO_TIMEOUT);
     }
     PR_Unlock(server->ml);
     PR_ClearInterrupt();
@@ -860,7 +860,7 @@
             cltsrv_log_file, TEST_LOG_NOTICE,
             ("\tServer(0x%p): waiting for %u workers to exit\n",
             me, server->pool.workers));
-        (void)PR_WaitCondVar(server->pool.exiting, PR_INTERVAL_NO_TIMEOUT);
+        (void)PR_WaitCondVar("./nsprpub/pr/tests/cltsrv.c:863", server->pool.exiting, PR_INTERVAL_NO_TIMEOUT);
     }
 
     server->state = cs_exit;
@@ -1065,7 +1065,7 @@
 
         PR_Lock(server->ml);
         while (server->state == cs_init)
-            PR_WaitCondVar(server->stateChange, PR_INTERVAL_NO_TIMEOUT);
+            PR_WaitCondVar("./nsprpub/pr/tests/cltsrv.c:1068", server->stateChange, PR_INTERVAL_NO_TIMEOUT);
         PR_Unlock(server->ml);
 
         TEST_LOG(
@@ -1125,7 +1125,7 @@
             TEST_ASSERT(NULL != client[index].thread);
             PR_Lock(client[index].ml);
             while (cs_init == client[index].state)
-                PR_WaitCondVar(client[index].stateChange, PR_INTERVAL_NO_TIMEOUT);
+                PR_WaitCondVar("./nsprpub/pr/tests/cltsrv.c:1128", client[index].stateChange, PR_INTERVAL_NO_TIMEOUT);
             PR_Unlock(client[index].ml);
         }
     }
@@ -1154,7 +1154,7 @@
                 client[index].state = cs_stop;
                 PR_Interrupt(client[index].thread);
                 while (cs_stop == client[index].state)
-                    PR_WaitCondVar(
+                    PR_WaitCondVar("./nsprpub/pr/tests/cltsrv.c:1157", 
                         client[index].stateChange, PR_INTERVAL_NO_TIMEOUT);
             }
             PR_Unlock(client[index].ml);
@@ -1183,7 +1183,7 @@
         server->state = cs_stop;
         PR_Interrupt(server->thread);
         while (cs_exit != server->state)
-            PR_WaitCondVar(server->stateChange, PR_INTERVAL_NO_TIMEOUT);
+            PR_WaitCondVar("./nsprpub/pr/tests/cltsrv.c:1186", server->stateChange, PR_INTERVAL_NO_TIMEOUT);
         PR_Unlock(server->ml);
 
         TEST_LOG(
diff --git a/nsprpub/pr/tests/concur.c b/nsprpub/pr/tests/concur.c
--- a/nsprpub/pr/tests/concur.c
+++ b/nsprpub/pr/tests/concur.c
@@ -79,7 +79,7 @@
     PR_Lock(context->ml);
     context->have += 1;
     while (context->want >= context->have)
-        PR_WaitCondVar(context->cv, PR_INTERVAL_NO_TIMEOUT);
+        PR_WaitCondVar("./nsprpub/pr/tests/concur.c:82", context->cv, PR_INTERVAL_NO_TIMEOUT);
     context->have -= 1;
     PR_Unlock(context->ml);
 }  /* Dull */
diff --git a/nsprpub/pr/tests/cvar.c b/nsprpub/pr/tests/cvar.c
--- a/nsprpub/pr/tests/cvar.c
+++ b/nsprpub/pr/tests/cvar.c
@@ -125,7 +125,7 @@
 	PR_Lock(cbp->bufLock);
 	/* wait while the buffer is full */
 	while (cbp->numFull == kQSIZE)
-		PR_WaitCondVar(cbp->notFull,PR_INTERVAL_NO_TIMEOUT);
+		PR_WaitCondVar("./nsprpub/pr/tests/cvar.c:128", cbp->notFull,PR_INTERVAL_NO_TIMEOUT);
 	cbp->data[(cbp->startIdx + cbp->numFull) % kQSIZE] = data;
 	cbp->numFull += 1;
 	
@@ -147,7 +147,7 @@
 	PR_Lock(cbp->bufLock);
 	/* wait while the buffer is empty */
 	while (cbp->numFull == 0)
-		PR_WaitCondVar(cbp->notEmpty,PR_INTERVAL_NO_TIMEOUT);
+		PR_WaitCondVar("./nsprpub/pr/tests/cvar.c:150", cbp->notEmpty,PR_INTERVAL_NO_TIMEOUT);
 	data = cbp->data[cbp->startIdx];
 	cbp->startIdx =(cbp->startIdx + 1) % kQSIZE;
 	cbp->numFull -= 1;
diff --git a/nsprpub/pr/tests/cvar2.c b/nsprpub/pr/tests/cvar2.c
--- a/nsprpub/pr/tests/cvar2.c
+++ b/nsprpub/pr/tests/cvar2.c
@@ -100,7 +100,7 @@
     for (index=0; index<info->loops; index++) {
         PR_Lock(info->lock);
         if (*info->tcount == 0)
-            PR_WaitCondVar(info->cvar, info->timeout);
+            PR_WaitCondVar("./nsprpub/pr/tests/cvar2.c:103", info->cvar, info->timeout);
 #if 0
         printf("shared thread %ld notified in loop %ld\n", info->id, index);
 #endif
@@ -129,7 +129,7 @@
         if (*info->tcount == 0) {
 	    DPRINTF(("PrivateCondVarThread: thread 0x%lx waiting on cvar = 0x%lx\n",
 				PR_GetCurrentThread(), info->cvar));
-            PR_WaitCondVar(info->cvar, info->timeout);
+            PR_WaitCondVar("./nsprpub/pr/tests/cvar2.c:132", info->cvar, info->timeout);
 	}
 #if 0
         printf("solo   thread %ld notified in loop %ld\n", info->id, index);
@@ -238,7 +238,7 @@
         /* Wait for threads to finish */
         PR_Lock(exitlock);
         while(exitcount < arg)
-            PR_WaitCondVar(exitcvar, PR_SecondsToInterval(60));
+            PR_WaitCondVar("./nsprpub/pr/tests/cvar2.c:241", exitcvar, PR_SecondsToInterval(60));
         PR_ASSERT(exitcount >= arg);
         exitcount -= arg;
         PR_Unlock(exitlock);
@@ -309,7 +309,7 @@
         /* Wait for threads to finish */
         PR_Lock(exitlock);
         while(exitcount < arg)
-            PR_WaitCondVar(exitcvar, PR_SecondsToInterval(60));
+            PR_WaitCondVar("./nsprpub/pr/tests/cvar2.c:312", exitcvar, PR_SecondsToInterval(60));
         PR_ASSERT(exitcount >= arg);
         exitcount -= arg;
         PR_Unlock(exitlock);
@@ -388,7 +388,7 @@
         while(exitcount < arg) {
 DPRINTF(("CondVarTestPUU: thread 0x%lx waiting on exitcvar = 0x%lx cnt = %ld\n",
 				PR_GetCurrentThread(), exitcvar, exitcount));
-            	PR_WaitCondVar(exitcvar, PR_SecondsToInterval(60));
+            	PR_WaitCondVar("./nsprpub/pr/tests/cvar2.c:391", exitcvar, PR_SecondsToInterval(60));
 	}
         PR_ASSERT(exitcount >= arg);
         exitcount -= arg;
@@ -471,7 +471,7 @@
         /* Wait for threads to finish */
         PR_Lock(exitlock);
         while(exitcount < arg)
-            PR_WaitCondVar(exitcvar, PR_SecondsToInterval(60));
+            PR_WaitCondVar("./nsprpub/pr/tests/cvar2.c:474", exitcvar, PR_SecondsToInterval(60));
         PR_ASSERT(exitcount >= arg);
         exitcount -= arg;
         PR_Unlock(exitlock);
@@ -601,7 +601,7 @@
         /* Wait for threads to finish */
         PR_Lock(exitlock);
         while(exitcount < arg*4)
-            PR_WaitCondVar(exitcvar, PR_SecondsToInterval(60));
+            PR_WaitCondVar("./nsprpub/pr/tests/cvar2.c:604", exitcvar, PR_SecondsToInterval(60));
         PR_ASSERT(exitcount >= arg*4);
         exitcount -= arg*4;
         PR_Unlock(exitlock);
@@ -715,7 +715,7 @@
         /* Wait for threads to finish */
         PR_Lock(exitlock);
         while(exitcount < arg*4)
-            PR_WaitCondVar(exitcvar, PR_SecondsToInterval(60));
+            PR_WaitCondVar("./nsprpub/pr/tests/cvar2.c:718", exitcvar, PR_SecondsToInterval(60));
         PR_ASSERT(exitcount >= arg*4);
         exitcount -= arg*4;
         PR_Unlock(exitlock);
@@ -842,7 +842,7 @@
         /* Wait for threads to finish */
         PR_Lock(exitlock);
         while(exitcount < arg*4)
-            PR_WaitCondVar(exitcvar, PR_SecondsToInterval(60));
+            PR_WaitCondVar("./nsprpub/pr/tests/cvar2.c:845", exitcvar, PR_SecondsToInterval(60));
         PR_ASSERT(exitcount >= arg*4);
         exitcount -= arg*4;
         PR_Unlock(exitlock);
diff --git a/nsprpub/pr/tests/initclk.c b/nsprpub/pr/tests/initclk.c
--- a/nsprpub/pr/tests/initclk.c
+++ b/nsprpub/pr/tests/initclk.c
@@ -61,7 +61,7 @@
 void ThreadFunc(void *arg)
 {
     PR_Lock(lock1);
-    PR_WaitCondVar(cv1, PR_MillisecondsToInterval(SHORT_TIMEOUT));
+    PR_WaitCondVar("./nsprpub/pr/tests/initclk.c:64", cv1, PR_MillisecondsToInterval(SHORT_TIMEOUT));
     PR_Unlock(lock1);
 }
 
@@ -90,7 +90,7 @@
             0);
     PR_ASSERT(NULL != thread);
     PR_Lock(lock2);
-    PR_WaitCondVar(cv2, PR_MillisecondsToInterval(LONG_TIMEOUT));
+    PR_WaitCondVar("./nsprpub/pr/tests/initclk.c:93", cv2, PR_MillisecondsToInterval(LONG_TIMEOUT));
     PR_Unlock(lock2);
     PR_JoinThread(thread);
     end = PR_IntervalNow();
diff --git a/nsprpub/pr/tests/inrval.c b/nsprpub/pr/tests/inrval.c
--- a/nsprpub/pr/tests/inrval.c
+++ b/nsprpub/pr/tests/inrval.c
@@ -148,7 +148,7 @@
         PRIntervalTime ticks = PR_SecondsToInterval(seconds);
         PR_Lock(ml);
         timein = PR_Now();
-        rv = PR_WaitCondVar(cv, ticks);
+        rv = PR_WaitCondVar("./nsprpub/pr/tests/inrval.c:151", cv, ticks);
         timeout = PR_Now();
         PR_Unlock(ml);
         LL_SUB(elapsed, timeout, timein);
diff --git a/nsprpub/pr/tests/intrio.c b/nsprpub/pr/tests/intrio.c
--- a/nsprpub/pr/tests/intrio.c
+++ b/nsprpub/pr/tests/intrio.c
@@ -121,7 +121,7 @@
     }
     PR_Lock(lock);
     while (!iothread_ready)
-        PR_WaitCondVar(cvar, PR_INTERVAL_NO_TIMEOUT);
+        PR_WaitCondVar("./nsprpub/pr/tests/intrio.c:124", cvar, PR_INTERVAL_NO_TIMEOUT);
     PR_Unlock(lock);
     abortio = PR_CreateThread(
         PR_USER_THREAD, AbortIO, iothread, PR_PRIORITY_NORMAL,
diff --git a/nsprpub/pr/tests/intrupt.c b/nsprpub/pr/tests/intrupt.c
--- a/nsprpub/pr/tests/intrupt.c
+++ b/nsprpub/pr/tests/intrupt.c
@@ -71,7 +71,7 @@
 
     /* some other thread (main) is doing the interrupt */
     PR_Lock(ml);
-    rv = PR_WaitCondVar(cv, PR_INTERVAL_NO_TIMEOUT);
+    rv = PR_WaitCondVar("./nsprpub/pr/tests/intrupt.c:74", cv, PR_INTERVAL_NO_TIMEOUT);
     if (debug_mode) printf( "Expected interrupt on wait CV and ");
     if (PR_FAILURE == rv)
     {
@@ -91,7 +91,7 @@
         passed = PR_FALSE;
     }
 
-    rv = PR_WaitCondVar(cv, 10);
+    rv = PR_WaitCondVar("./nsprpub/pr/tests/intrupt.c:94", cv, 10);
     if (debug_mode)
     {
         printf(
@@ -103,7 +103,7 @@
     /* interrupt myself, then clear */
     PR_Interrupt(me);
     PR_ClearInterrupt();
-    rv = PR_WaitCondVar(cv, 10);
+    rv = PR_WaitCondVar("./nsprpub/pr/tests/intrupt.c:106", cv, 10);
     if (debug_mode)
     {
         printf("Expected success on wait CV and ");
@@ -119,7 +119,7 @@
 
     /* set, then wait - interrupt - then wait again */
     PR_Interrupt(me);
-    rv = PR_WaitCondVar(cv, 10);
+    rv = PR_WaitCondVar("./nsprpub/pr/tests/intrupt.c:122", cv, 10);
     if (debug_mode) printf( "Expected interrupt on wait CV and ");
     if (PR_FAILURE == rv)
     {
@@ -139,7 +139,7 @@
         passed = PR_FALSE;
     }
 
-    rv = PR_WaitCondVar(cv, 10);
+    rv = PR_WaitCondVar("./nsprpub/pr/tests/intrupt.c:142", cv, 10);
     if (debug_mode)
     {
         printf(
@@ -202,7 +202,7 @@
 	/* block the interrupt */
 	PR_BlockInterrupt();
     PR_Lock(ml);
-    rv = PR_WaitCondVar(cv, PR_SecondsToInterval(4));
+    rv = PR_WaitCondVar("./nsprpub/pr/tests/intrupt.c:205", cv, PR_SecondsToInterval(4));
 	PR_Unlock(ml);
     if (debug_mode)
     {
diff --git a/nsprpub/pr/tests/io_timeout.c b/nsprpub/pr/tests/io_timeout.c
--- a/nsprpub/pr/tests/io_timeout.c
+++ b/nsprpub/pr/tests/io_timeout.c
@@ -225,7 +225,7 @@
     while(alive) {
 		if (debug_mode)
         	printf("main loop awake; alive = %d\n", alive);
-        PR_WaitCondVar(dead_cv, PR_INTERVAL_NO_TIMEOUT);
+        PR_WaitCondVar("./nsprpub/pr/tests/io_timeout.c:228", dead_cv, PR_INTERVAL_NO_TIMEOUT);
     }
     PR_Unlock(dead_lock);
 
diff --git a/nsprpub/pr/tests/io_timeoutk.c b/nsprpub/pr/tests/io_timeoutk.c
--- a/nsprpub/pr/tests/io_timeoutk.c
+++ b/nsprpub/pr/tests/io_timeoutk.c
@@ -179,7 +179,7 @@
     PR_Lock(dead_lock);
     while(alive) {
         if (debug_mode) printf("main loop awake; alive = %d\n", alive);
-        PR_WaitCondVar(dead_cv, PR_INTERVAL_NO_TIMEOUT);
+        PR_WaitCondVar("./nsprpub/pr/tests/io_timeoutk.c:182", dead_cv, PR_INTERVAL_NO_TIMEOUT);
     }
     PR_Unlock(dead_lock);
 }
diff --git a/nsprpub/pr/tests/io_timeoutu.c b/nsprpub/pr/tests/io_timeoutu.c
--- a/nsprpub/pr/tests/io_timeoutu.c
+++ b/nsprpub/pr/tests/io_timeoutu.c
@@ -180,7 +180,7 @@
     PR_Lock(dead_lock);
     while(alive) {
         if (debug_mode) printf("main loop awake; alive = %d\n", alive);
-        PR_WaitCondVar(dead_cv, PR_INTERVAL_NO_TIMEOUT);
+        PR_WaitCondVar("./nsprpub/pr/tests/io_timeoutu.c:183", dead_cv, PR_INTERVAL_NO_TIMEOUT);
     }
     PR_Unlock(dead_lock);
 }
diff --git a/nsprpub/pr/tests/logger.c b/nsprpub/pr/tests/logger.c
--- a/nsprpub/pr/tests/logger.c
+++ b/nsprpub/pr/tests/logger.c
@@ -82,7 +82,7 @@
     for (i = 0; i < 10; ++i)
     {
         PR_Lock(ml);
-        PR_WaitCondVar(cv, PR_SecondsToInterval(1));
+        PR_WaitCondVar("./nsprpub/pr/tests/logger.c:85", cv, PR_SecondsToInterval(1));
         PR_Unlock(ml);
     }
     
diff --git a/nsprpub/pr/tests/ntioto.c b/nsprpub/pr/tests/ntioto.c
--- a/nsprpub/pr/tests/ntioto.c
+++ b/nsprpub/pr/tests/ntioto.c
@@ -145,7 +145,7 @@
     while( state != AllDone )  {
         PR_Lock( ml );
         while( state != RunAcceptRead )
-            PR_WaitCondVar( cv, PR_INTERVAL_NO_TIMEOUT );
+            PR_WaitCondVar("./nsprpub/pr/tests/ntioto.c:148",  cv, PR_INTERVAL_NO_TIMEOUT );
         if ( ++iCounter >= jitter )
             state = AllDone;
         else
@@ -164,7 +164,7 @@
     while( state != AllDone )  {
         PR_Lock( ml );
         while( state != RunJitter && state != AllDone )
-            PR_WaitCondVar( cv, PR_INTERVAL_NO_TIMEOUT );
+            PR_WaitCondVar("./nsprpub/pr/tests/ntioto.c:167",  cv, PR_INTERVAL_NO_TIMEOUT );
         if ( state != AllDone)
             state = RunAcceptRead;
         if ( verbose ) printf("+");
diff --git a/nsprpub/pr/tests/provider.c b/nsprpub/pr/tests/provider.c
--- a/nsprpub/pr/tests/provider.c
+++ b/nsprpub/pr/tests/provider.c
@@ -376,7 +376,7 @@
         PR_Lock(client->ml);
         client->operations += 1;
         client->bytesTransferred += 2 * descbytes;
-        rv = PR_WaitCondVar(client->stateChange, rand() % clipping);
+        rv = PR_WaitCondVar("./nsprpub/pr/tests/provider.c:379", client->stateChange, rand() % clipping);
         PR_Unlock(client->ml);
         if (Aborted(rv)) break;
     }
@@ -846,7 +846,7 @@
                 cltsrv_log_file, TEST_LOG_VERBOSE,
                 ("\t\tWorker(0x%p): waiting for accept slot[%d]\n",
                 me, pool->accepting));
-            rv = PR_WaitCondVar(pool->acceptComplete, PR_INTERVAL_NO_TIMEOUT);
+            rv = PR_WaitCondVar("./nsprpub/pr/tests/provider.c:849", pool->acceptComplete, PR_INTERVAL_NO_TIMEOUT);
             if (Aborted(rv) || (cs_run != server->state))
             {
                 TEST_LOG(
@@ -987,7 +987,7 @@
     PR_Lock(server->ml);
     while ((cs_run == server->state) && !Aborted(rv))
     {
-        rv = PR_WaitCondVar(server->stateChange, PR_INTERVAL_NO_TIMEOUT);
+        rv = PR_WaitCondVar("./nsprpub/pr/tests/provider.c:990", server->stateChange, PR_INTERVAL_NO_TIMEOUT);
     }
     PR_Unlock(server->ml);
     PR_ClearInterrupt();
@@ -1023,7 +1023,7 @@
             cltsrv_log_file, TEST_LOG_NOTICE,
             ("\tServer(0x%p): waiting for %u workers to exit\n",
             me, server->pool.workers));
-        (void)PR_WaitCondVar(server->pool.exiting, PR_INTERVAL_NO_TIMEOUT);
+        (void)PR_WaitCondVar("./nsprpub/pr/tests/provider.c:1026", server->pool.exiting, PR_INTERVAL_NO_TIMEOUT);
     }
 
     server->state = cs_exit;
@@ -1231,7 +1231,7 @@
 
         PR_Lock(server->ml);
         while (server->state == cs_init)
-            PR_WaitCondVar(server->stateChange, PR_INTERVAL_NO_TIMEOUT);
+            PR_WaitCondVar("./nsprpub/pr/tests/provider.c:1234", server->stateChange, PR_INTERVAL_NO_TIMEOUT);
         PR_Unlock(server->ml);
 
         TEST_LOG(
@@ -1286,7 +1286,7 @@
             TEST_ASSERT(PR_SUCCESS == rv);
             PR_Lock(client[index].ml);
             while (cs_init == client[index].state)
-                PR_WaitCondVar(client[index].stateChange, PR_INTERVAL_NO_TIMEOUT);
+                PR_WaitCondVar("./nsprpub/pr/tests/provider.c:1289", client[index].stateChange, PR_INTERVAL_NO_TIMEOUT);
             PR_Unlock(client[index].ml);
         }
     }
@@ -1315,7 +1315,7 @@
                 client[index].state = cs_stop;
                 PR_Interrupt(client[index].thread);
                 while (cs_stop == client[index].state)
-                    PR_WaitCondVar(
+                    PR_WaitCondVar("./nsprpub/pr/tests/provider.c:1318", 
                         client[index].stateChange, PR_INTERVAL_NO_TIMEOUT);
             }
             PR_Unlock(client[index].ml);
@@ -1344,7 +1344,7 @@
         server->state = cs_stop;
         PR_Interrupt(server->thread);
         while (cs_exit != server->state)
-            PR_WaitCondVar(server->stateChange, PR_INTERVAL_NO_TIMEOUT);
+            PR_WaitCondVar("./nsprpub/pr/tests/provider.c:1347", server->stateChange, PR_INTERVAL_NO_TIMEOUT);
         PR_Unlock(server->ml);
 
         TEST_LOG(
diff --git a/nsprpub/pr/tests/ranfile.c b/nsprpub/pr/tests/ranfile.c
--- a/nsprpub/pr/tests/ranfile.c
+++ b/nsprpub/pr/tests/ranfile.c
@@ -354,7 +354,7 @@
                 thread_scope, PR_JOINABLE_THREAD, 0);
 
             PR_Lock(ml);
-            PR_WaitCondVar(cv, interleave);  /* start new ones slowly */
+            PR_WaitCondVar("./nsprpub/pr/tests/ranfile.c:357", cv, interleave);  /* start new ones slowly */
             PR_Unlock(ml);
         }
 
@@ -376,7 +376,7 @@
             {
                 PR_Lock(ml);
                 while (hammer[poll].action < sg_done)
-                    PR_WaitCondVar(cv, PR_INTERVAL_NO_TIMEOUT);
+                    PR_WaitCondVar("./nsprpub/pr/tests/ranfile.c:379", cv, PR_INTERVAL_NO_TIMEOUT);
                 PR_Unlock(ml);
 
                 active -= 1;  /* this is another one down */
diff --git a/nsprpub/pr/tests/server_test.c b/nsprpub/pr/tests/server_test.c
--- a/nsprpub/pr/tests/server_test.c
+++ b/nsprpub/pr/tests/server_test.c
@@ -153,7 +153,7 @@
     if (debug_mode) DPRINTF("\t%s waiting for state %d\n", waiter, state);
 
     while(!(ServerState & state))
-        PR_WaitCondVar(ServerStateCV, PR_INTERVAL_NO_TIMEOUT);
+        PR_WaitCondVar("./nsprpub/pr/tests/server_test.c:156", ServerStateCV, PR_INTERVAL_NO_TIMEOUT);
     rv = ServerState;
 
     if (debug_mode) DPRINTF("\t%s resuming from wait for state %d; state now %d\n", 
diff --git a/nsprpub/pr/tests/servr_kk.c b/nsprpub/pr/tests/servr_kk.c
--- a/nsprpub/pr/tests/servr_kk.c
+++ b/nsprpub/pr/tests/servr_kk.c
@@ -119,7 +119,7 @@
     if (debug_mode) DPRINTF("\t%s waiting for state %d\n", waiter, state);
 
     while(!(ServerState & state))
-        PR_WaitCondVar(ServerStateCV, PR_INTERVAL_NO_TIMEOUT);
+        PR_WaitCondVar("./nsprpub/pr/tests/servr_kk.c:122", ServerStateCV, PR_INTERVAL_NO_TIMEOUT);
     rv = ServerState;
 
     if (debug_mode) DPRINTF("\t%s resuming from wait for state %d; state now %d\n", 
diff --git a/nsprpub/pr/tests/servr_ku.c b/nsprpub/pr/tests/servr_ku.c
--- a/nsprpub/pr/tests/servr_ku.c
+++ b/nsprpub/pr/tests/servr_ku.c
@@ -120,7 +120,7 @@
     if (debug_mode) DPRINTF("\t%s waiting for state %d\n", waiter, state);
 
     while(!(ServerState & state))
-        PR_WaitCondVar(ServerStateCV, PR_INTERVAL_NO_TIMEOUT);
+        PR_WaitCondVar("./nsprpub/pr/tests/servr_ku.c:123", ServerStateCV, PR_INTERVAL_NO_TIMEOUT);
     rv = ServerState;
 
     if (debug_mode) DPRINTF("\t%s resuming from wait for state %d; state now %d\n", 
diff --git a/nsprpub/pr/tests/servr_uk.c b/nsprpub/pr/tests/servr_uk.c
--- a/nsprpub/pr/tests/servr_uk.c
+++ b/nsprpub/pr/tests/servr_uk.c
@@ -122,7 +122,7 @@
     if (debug_mode) DPRINTF("\t%s waiting for state %d\n", waiter, state);
 
     while(!(ServerState & state))
-        PR_WaitCondVar(ServerStateCV, PR_INTERVAL_NO_TIMEOUT);
+        PR_WaitCondVar("./nsprpub/pr/tests/servr_uk.c:125", ServerStateCV, PR_INTERVAL_NO_TIMEOUT);
     rv = ServerState;
 
     if (debug_mode) DPRINTF("\t%s resuming from wait for state %d; state now %d\n", 
diff --git a/nsprpub/pr/tests/servr_uu.c b/nsprpub/pr/tests/servr_uu.c
--- a/nsprpub/pr/tests/servr_uu.c
+++ b/nsprpub/pr/tests/servr_uu.c
@@ -120,7 +120,7 @@
     if (debug_mode) DPRINTF("\t%s waiting for state %d\n", waiter, state);
 
     while(!(ServerState & state))
-        PR_WaitCondVar(ServerStateCV, PR_INTERVAL_NO_TIMEOUT);
+        PR_WaitCondVar("./nsprpub/pr/tests/servr_uu.c:123", ServerStateCV, PR_INTERVAL_NO_TIMEOUT);
     rv = ServerState;
 
     if (debug_mode) DPRINTF("\t%s resuming from wait for state %d; state now %d\n", 
diff --git a/nsprpub/pr/tests/switch.c b/nsprpub/pr/tests/switch.c
--- a/nsprpub/pr/tests/switch.c
+++ b/nsprpub/pr/tests/switch.c
@@ -96,7 +96,7 @@
     {
         PR_Lock(shared->ml);
         while (shared->twiddle && (PR_SUCCESS == status))
-            status = PR_WaitCondVar(shared->cv, PR_INTERVAL_NO_TIMEOUT);
+            status = PR_WaitCondVar("./nsprpub/pr/tests/switch.c:99", shared->cv, PR_INTERVAL_NO_TIMEOUT);
 		if (verbosity) PR_fprintf(debug_out, "+");
         shared->twiddle = PR_TRUE;
         shared->next->twiddle = PR_FALSE;
@@ -204,7 +204,7 @@
 			PR_NotifyCondVar(shared->cv);
 			while (home.twiddle)
             {
-				status = PR_WaitCondVar(home.cv, PR_INTERVAL_NO_TIMEOUT);
+				status = PR_WaitCondVar("./nsprpub/pr/tests/switch.c:207", home.cv, PR_INTERVAL_NO_TIMEOUT);
 				if (PR_FAILURE == status)
 				    failed = PR_TRUE;
             }
diff --git a/nsprpub/pr/tests/tmoacc.c b/nsprpub/pr/tests/tmoacc.c
--- a/nsprpub/pr/tests/tmoacc.c
+++ b/nsprpub/pr/tests/tmoacc.c
@@ -276,7 +276,7 @@
 
                 PR_Lock(shared->ml);
                 while (shared->status == running)
-                    PR_WaitCondVar(shared->cv, PR_INTERVAL_NO_TIMEOUT);
+                    PR_WaitCondVar("./nsprpub/pr/tests/tmoacc.c:279", shared->cv, PR_INTERVAL_NO_TIMEOUT);
                 PR_Unlock(shared->ml);
                 for (index = 0; index < threads; ++index)
                 {
diff --git a/nsprpub/pr/tests/xnotify.c b/nsprpub/pr/tests/xnotify.c
--- a/nsprpub/pr/tests/xnotify.c
+++ b/nsprpub/pr/tests/xnotify.c
@@ -254,7 +254,7 @@
 
     PR_Lock(shared->o1);
     LogNow("T2 waiting 5 seconds on o1", PR_SUCCESS);
-    rv = PR_WaitCondVar(shared->cv1, PR_SecondsToInterval(5));
+    rv = PR_WaitCondVar("./nsprpub/pr/tests/xnotify.c:257", shared->cv1, PR_SecondsToInterval(5));
     if (PR_SUCCESS == rv) LogNow("T2 resuming on o1", rv);
     else LogNow("T2 wait failed on o1", rv);
 
@@ -272,7 +272,7 @@
 
     PR_Lock(shared->o2);
     LogNow("T3 waiting 5 seconds on o2", PR_SUCCESS);
-    rv = PR_WaitCondVar(shared->cv2, PR_SecondsToInterval(5));
+    rv = PR_WaitCondVar("./nsprpub/pr/tests/xnotify.c:275", shared->cv2, PR_SecondsToInterval(5));
     if (PR_SUCCESS == rv) LogNow("T3 resuming on o2", rv);
     else LogNow("T3 wait failed on o2", rv);
     rv = PR_NotifyCondVar(shared->cv2);
@@ -303,7 +303,7 @@
 
     PR_Lock(sharedL.o1);
     LogNow("T1 waiting 3 seconds on o1", PR_SUCCESS);
-    rv = PR_WaitCondVar(sharedL.cv1, PR_SecondsToInterval(3));
+    rv = PR_WaitCondVar("./nsprpub/pr/tests/xnotify.c:306", sharedL.cv1, PR_SecondsToInterval(3));
     if (PR_SUCCESS == rv) LogNow("T1 resuming on o1", rv);
     else LogNow("T1 wait on o1 failed", rv);
     PR_Unlock(sharedL.o1);
@@ -320,7 +320,7 @@
 
     PR_Lock(sharedL.o2);
     LogNow("T1 waiting forever on o2", PR_SUCCESS);
-    rv = PR_WaitCondVar(sharedL.cv2, PR_INTERVAL_NO_TIMEOUT);
+    rv = PR_WaitCondVar("./nsprpub/pr/tests/xnotify.c:323", sharedL.cv2, PR_INTERVAL_NO_TIMEOUT);
     if (PR_SUCCESS == rv) LogNow("T1 resuming on o2", rv);
     else LogNow("T1 wait on o2 failed", rv);
     PR_Unlock(sharedL.o2);
diff --git a/nsprpub/pr/tests/y2ktmo.c b/nsprpub/pr/tests/y2ktmo.c
--- a/nsprpub/pr/tests/y2ktmo.c
+++ b/nsprpub/pr/tests/y2ktmo.c
@@ -334,7 +334,7 @@
         exit(1);
     }
     PR_Lock(ml);
-    PR_WaitCondVar(cv, timeout);
+    PR_WaitCondVar("./nsprpub/pr/tests/y2ktmo.c:337", cv, timeout);
     PR_Unlock(ml);
     elapsed = (PRIntervalTime)(PR_IntervalNow() - start_time);
     if (elapsed + tolerance < timeout || elapsed > timeout + tolerance) {
diff --git a/parser/htmlparser/src/nsParser.cpp b/parser/htmlparser/src/nsParser.cpp
--- a/parser/htmlparser/src/nsParser.cpp
+++ b/parser/htmlparser/src/nsParser.cpp
@@ -532,7 +532,7 @@
 
     mKeepParsing = PR_FALSE;
     if (mCurrentlyParsing) {
-      PR_WaitCondVar(mCVar.get(), PR_INTERVAL_NO_TIMEOUT);
+      PR_WaitCondVar("./parser/htmlparser/src/nsParser.cpp:535", mCVar.get(), PR_INTERVAL_NO_TIMEOUT);
       NS_ASSERTION(!mCurrentlyParsing, "Didn't actually stop parsing?");
     }
   }
diff --git a/security/manager/ssl/src/nsCertVerificationThread.cpp b/security/manager/ssl/src/nsCertVerificationThread.cpp
--- a/security/manager/ssl/src/nsCertVerificationThread.cpp
+++ b/security/manager/ssl/src/nsCertVerificationThread.cpp
@@ -135,7 +135,7 @@
       while (!mExitRequested && (0 == verification_thread_singleton->mJobQ.GetSize())) {
         // no work to do ? let's wait a moment
 
-        PR_WaitCondVar(mCond, PR_INTERVAL_NO_TIMEOUT);
+        PR_WaitCondVar("./security/manager/ssl/src/nsCertVerificationThread.cpp:138", mCond, PR_INTERVAL_NO_TIMEOUT);
       }
       
       if (mExitRequested)
diff --git a/security/manager/ssl/src/nsNSSCallbacks.cpp b/security/manager/ssl/src/nsNSSCallbacks.cpp
--- a/security/manager/ssl/src/nsNSSCallbacks.cpp
+++ b/security/manager/ssl/src/nsNSSCallbacks.cpp
@@ -430,7 +430,7 @@
         locker.lock();
       }
 
-      PR_WaitCondVar(waitCondition, wait_interval);
+      PR_WaitCondVar("./security/manager/ssl/src/nsNSSCallbacks.cpp:433", waitCondition, wait_interval);
       
       if (!waitFlag)
         break;
diff --git a/security/manager/ssl/src/nsNSSShutDown.cpp b/security/manager/ssl/src/nsNSSShutDown.cpp
--- a/security/manager/ssl/src/nsNSSShutDown.cpp
+++ b/security/manager/ssl/src/nsNSSShutDown.cpp
@@ -317,7 +317,7 @@
   PR_Lock(mNSSActivityStateLock);
 
     while (mNSSRestrictedThread && mNSSRestrictedThread != PR_GetCurrentThread()) {
-      PR_WaitCondVar(mNSSActivityChanged, PR_INTERVAL_NO_TIMEOUT);
+      PR_WaitCondVar("./security/manager/ssl/src/nsNSSShutDown.cpp:320", mNSSActivityChanged, PR_INTERVAL_NO_TIMEOUT);
     }
 
     ++mNSSActivityCounter;
@@ -423,7 +423,7 @@
   
     if (!mBlockingUICounter) {
       while (0 < mNSSActivityCounter && !mBlockingUICounter) {
-        PR_WaitCondVar(mNSSActivityChanged, PR_TicksPerSecond());
+        PR_WaitCondVar("./security/manager/ssl/src/nsNSSShutDown.cpp:426", mNSSActivityChanged, PR_TicksPerSecond());
       }
       
       if (mBlockingUICounter) {
diff --git a/security/manager/ssl/src/nsSSLThread.cpp b/security/manager/ssl/src/nsSSLThread.cpp
--- a/security/manager/ssl/src/nsSSLThread.cpp
+++ b/security/manager/ssl/src/nsSSLThread.cpp
@@ -977,7 +977,7 @@
         {
           // no work to do ? let's wait a moment
 
-          PR_WaitCondVar(mCond, PR_INTERVAL_NO_TIMEOUT);
+          PR_WaitCondVar("./security/manager/ssl/src/nsSSLThread.cpp:980", mCond, PR_INTERVAL_NO_TIMEOUT);
         }
         
       } while (!pending_work && !mExitRequested && !mSocketScheduledToBeDestroyed);
diff --git a/security/nss/cmd/libpkix/pkix_pl/system/test_mutex2.c b/security/nss/cmd/libpkix/pkix_pl/system/test_mutex2.c
--- a/security/nss/cmd/libpkix/pkix_pl/system/test_mutex2.c
+++ b/security/nss/cmd/libpkix/pkix_pl/system/test_mutex2.c
@@ -60,7 +60,7 @@
                         (box2 == 0) ||
                         (box3 == 0)) &&
                         (status == PR_SUCCESS))
-                        status = PR_WaitCondVar(cv, PR_INTERVAL_NO_TIMEOUT);
+                        status = PR_WaitCondVar("./security/nss/cmd/libpkix/pkix_pl/system/test_mutex2.c:63", cv, PR_INTERVAL_NO_TIMEOUT);
 
                 (void) printf("\tConsumer got Box1 = %d ", box1);
                 box1 = 0;
@@ -92,7 +92,7 @@
         for (i = 0; i < 5; i++) {
                 (void) PKIX_PL_Mutex_Lock(mutex, plContext);
                 while ((*box != 0) && (status == PR_SUCCESS))
-                        status = PR_WaitCondVar(cv, PR_INTERVAL_NO_TIMEOUT);
+                        status = PR_WaitCondVar("./security/nss/cmd/libpkix/pkix_pl/system/test_mutex2.c:95", cv, PR_INTERVAL_NO_TIMEOUT);
 
                 *box = i+1;
                 (void) printf
diff --git a/security/nss/cmd/strsclnt/strsclnt.c b/security/nss/cmd/strsclnt/strsclnt.c
--- a/security/nss/cmd/strsclnt/strsclnt.c
+++ b/security/nss/cmd/strsclnt/strsclnt.c
@@ -562,7 +562,7 @@
 {
     PR_Lock(lv->lock);
     while (lv->count > 0) {
-    	PR_WaitCondVar(lv->condVar, PR_INTERVAL_NO_TIMEOUT);
+    	PR_WaitCondVar("./security/nss/cmd/strsclnt/strsclnt.c:565", lv->condVar, PR_INTERVAL_NO_TIMEOUT);
     }
     PR_Unlock(lv->lock);
 }
diff --git a/security/nss/cmd/vfyserv/vfyutil.c b/security/nss/cmd/vfyserv/vfyutil.c
--- a/security/nss/cmd/vfyserv/vfyutil.c
+++ b/security/nss/cmd/vfyserv/vfyutil.c
@@ -474,7 +474,7 @@
     }
     PR_Lock(threadMGR->threadLock);
     while (threadMGR->numRunning >= MAX_THREADS) {
-	PR_WaitCondVar(threadMGR->threadStartQ, PR_INTERVAL_NO_TIMEOUT);
+	PR_WaitCondVar("./security/nss/cmd/vfyserv/vfyutil.c:477", threadMGR->threadStartQ, PR_INTERVAL_NO_TIMEOUT);
     }
     for (i = 0; i < threadMGR->numUsed; ++i) {
 	slot = &threadMGR->threads[i];
@@ -528,7 +528,7 @@
 	return SECSuccess;
     PR_Lock(threadMGR->threadLock);
     while (threadMGR->numRunning > 0) {
-	PR_WaitCondVar(threadMGR->threadEndQ, PR_INTERVAL_NO_TIMEOUT);
+	PR_WaitCondVar("./security/nss/cmd/vfyserv/vfyutil.c:531", threadMGR->threadEndQ, PR_INTERVAL_NO_TIMEOUT);
 	for (i = 0; i < threadMGR->numUsed; ++i) {
 	    slot = &threadMGR->threads[i];
 	    if (slot->running == rs_zombie)  {
@@ -604,7 +604,7 @@
 {
     PR_Lock(lv->lock);
     while (lv->count > 0) {
-	PR_WaitCondVar(lv->condVar, PR_INTERVAL_NO_TIMEOUT);
+	PR_WaitCondVar("./security/nss/cmd/vfyserv/vfyutil.c:607", lv->condVar, PR_INTERVAL_NO_TIMEOUT);
     }
     PR_Unlock(lv->lock);
 }
diff --git a/security/nss/lib/util/nssilock.c b/security/nss/lib/util/nssilock.c
--- a/security/nss/lib/util/nssilock.c
+++ b/security/nss/lib/util/nssilock.c
@@ -138,7 +138,7 @@
         } else {
             PR_Lock(ttLock);
             while( NUM_TT_ENTRIES < idx )
-                PR_WaitCondVar(ttCVar, PR_INTERVAL_NO_WAIT);
+                PR_WaitCondVar("./security/nss/lib/util/nssilock.c:141", ttCVar, PR_INTERVAL_NO_WAIT);
             PR_Unlock(ttLock);
             goto RetryTrace;
         }
@@ -336,7 +336,7 @@
     PRIntervalTime callTime;
 
     callTime = PR_IntervalNow();
-    rc = PR_WaitCondVar( cvar->cvar, timeout );
+    rc = PR_WaitCondVar("./security/nss/lib/util/nssilock.c:339",  cvar->cvar, timeout );
     callTime = PR_IntervalNow() - callTime;
     
     Vtrace( WaitCondVar, cvar->ltype, callTime, 0, cvar, line, file );
diff --git a/security/nss/lib/util/nssilock.h b/security/nss/lib/util/nssilock.h
--- a/security/nss/lib/util/nssilock.h
+++ b/security/nss/lib/util/nssilock.h
@@ -299,7 +299,7 @@
 
 #define PZ_NewCondVar(l)        PR_NewCondVar((l))
 #define PZ_DestroyCondVar(v)    PR_DestroyCondVar((v))
-#define PZ_WaitCondVar(v,t)     PR_WaitCondVar((v),(t))
+#define PZ_WaitCondVar(v,t)     PR_WaitCondVar("NSS", (v),(t))
 #define PZ_NotifyCondVar(v)     PR_NotifyCondVar((v))
 #define PZ_NotifyAllCondVar(v)  PR_NotifyAllCondVar((v))
 
diff --git a/testing/mochitest/ssltunnel/ssltunnel.cpp b/testing/mochitest/ssltunnel/ssltunnel.cpp
--- a/testing/mochitest/ssltunnel/ssltunnel.cpp
+++ b/testing/mochitest/ssltunnel/ssltunnel.cpp
@@ -1276,7 +1276,7 @@
   }
   // now wait for someone to tell us to quit
   PR_Lock(shutdown_lock);
-  PR_WaitCondVar(shutdown_condvar, PR_INTERVAL_NO_TIMEOUT);
+  PR_WaitCondVar("./testing/mochitest/ssltunnel/ssltunnel.cpp:1279", shutdown_condvar, PR_INTERVAL_NO_TIMEOUT);
   PR_Unlock(shutdown_lock);
   shutdown_server = true;
   printf("Shutting down...\n");
diff --git a/timeout_rewriter.py b/timeout_rewriter.py
new file mode 100644
--- /dev/null
+++ b/timeout_rewriter.py
@@ -0,0 +1,83 @@
+'''
+Usage: Apply the patch in which this is in, then simply run this script
+from the root of the src dir (where it is). It will modify the source
+tree accordingly.
+
+Make sure not to commit the changes it does!
+
+Also when you undo this, revert --all is not enough if you also have
+mobile-browser, must revert there too!
+'''
+
+import os, re
+from fnmatch import fnmatch
+
+for i in os.walk('.'):
+  dirpath, dirnames, filenames = i
+  for f in filenames:
+    if f == 'ptsynch.c': continue
+    # Cond vars
+    '''
+    name = os.path.join(dirpath, f)
+    if fnmatch(name, '*.c') or fnmatch(name, '*.cpp'):# or fnmatch(name, '*.c'):
+      data = open(name, 'r').read()
+      if 'PR_WaitCondVar' not in data: continue
+      lines = data.split('\n')
+      added = False
+      for i in range(len(lines)):
+        line = lines[i]
+        if 'PR_WaitCondVar(' not in line: continue
+        if '_PR_WaitCondVar' in line: continue
+
+        added = True
+        if 'PR_WaitCondVar(PRCondVar' in line:
+          lines[i] = line.replace('PR_WaitCondVar(PRCondVar', 'PR_WaitCondVar(char* src, PRCondVar')
+        else:
+          lines[i] = line.replace('PR_WaitCondVar(', 'PR_WaitCondVar("' + name + ':' + str(i+1) + '", ')
+
+      if added:
+        print "Modified:", name
+        out = open(name, 'w')
+        out.write('\n'.join(lines))
+        out.close()
+    '''
+
+    # Timers
+    name = os.path.join(dirpath, f)
+#    if 'Incremental' not in name: continue
+    if fnmatch(name, '*.c') or fnmatch(name, '*.cpp') or fnmatch(name, '*.js') or fnmatch(name, '*.jsm') or fnmatch(name, '*.h'):
+      data = open(name, 'r').read()
+      if '@mozilla.org/timer;1' not in data and 'NS_TIMER_CONTRACTID' not in data: continue
+      lines = data.split('\n')
+      added = False
+      lastRelevant = -100
+      for i in range(len(lines)):
+        line = lines[i]
+        if '@mozilla.org/timer;1' in line or 'NS_TIMER_CONTRACTID' in line: lastRelevant = i
+        relevant = i - lastRelevant <= 10 # super-smart heuristic that can never ever ever be wrong (unless it is)
+#        print relevant, line
+        if 'init' not in line and 'Init' not in line: continue
+        texted = '"' + name + ':' + str(i+1) + '", '
+        if texted in line: raise Exception("wtf? re-running on processed data perhaps?")
+        if fnmatch(name, '*.c') or fnmatch(name, '*.cpp') or fnmatch(name, '*.h'):
+          if relevant: # Need relevance for Init
+            lines[i] = line.replace('->Init(', '->Init(' + texted)
+          if lines[i] == line:
+            lines[i] = line.replace('InitWithFuncCallback(', 'InitWithFuncCallback(' + texted)
+          if lines[i] == line:
+            lines[i] = line.replace('InitWithCallback(', 'InitWithCallback(' + texted)
+        else: #fnmatch(name, '*.js*') or jsm
+          if relevant: # Need relevance for init
+            lines[i] = line.replace('.init(', '.init(' + texted)
+          if lines[i] == line:
+            lines[i] = line.replace('initWithCallback(', 'initWithCallback(' + texted)
+        added_now = lines[i] != line
+        if added_now: print "Change:", line, 'to', lines[i]
+        added = added or added_now
+
+      if added:
+        print "Modified:", name
+        out = open(name, 'w')
+        out.write('\n'.join(lines))
+        out.close()
+
diff --git a/tools/trace-malloc/spacetrace.c b/tools/trace-malloc/spacetrace.c
--- a/tools/trace-malloc/spacetrace.c
+++ b/tools/trace-malloc/spacetrace.c
@@ -5151,7 +5151,7 @@
                  **  If they do not have cache hits, then we will end up
                  **      with a bunch of waiters here....
                  */
-                PR_WaitCondVar(inCache->mCacheMiss, PR_INTERVAL_NO_TIMEOUT);
+                PR_WaitCondVar("./tools/trace-malloc/spacetrace.c:5154", inCache->mCacheMiss, PR_INTERVAL_NO_TIMEOUT);
             }
 
             /*
diff --git a/widget/src/android/nsAppShell.cpp b/widget/src/android/nsAppShell.cpp
--- a/widget/src/android/nsAppShell.cpp
+++ b/widget/src/android/nsAppShell.cpp
@@ -152,11 +152,11 @@
         EVLOG("nsAppShell: waiting on mQueueCond");
         t0 = PR_Now();
 
-        PR_WaitCondVar(mQueueCond, PR_MillisecondsToInterval(10000));
+        PR_WaitCondVar("./widget/src/android/nsAppShell.cpp:155", mQueueCond, PR_MillisecondsToInterval(10000));
         t1 = PR_Now();
         EVLOG("nsAppShell: wait done, waited %d ms", (int)(t1-t0)/1000);
 #else
-        PR_WaitCondVar(mQueueCond, PR_INTERVAL_NO_TIMEOUT);
+        PR_WaitCondVar("./widget/src/android/nsAppShell.cpp:159", mQueueCond, PR_INTERVAL_NO_TIMEOUT);
 #endif
 
         curEvent = GetNextEvent();
@@ -265,7 +265,7 @@
 
         // The OS is sending us to the background, block this thread until 
         // onResume is called to signal that we're back in the foreground
-        PR_WaitCondVar(mPaused, PR_INTERVAL_NO_TIMEOUT);
+        PR_WaitCondVar("./widget/src/android/nsAppShell.cpp:268", mPaused, PR_INTERVAL_NO_TIMEOUT);
         break;
     }
 
diff --git a/xpcom/glue/BlockingResourceBase.cpp b/xpcom/glue/BlockingResourceBase.cpp
--- a/xpcom/glue/BlockingResourceBase.cpp
+++ b/xpcom/glue/BlockingResourceBase.cpp
@@ -369,7 +369,7 @@
 
     // give up mutex until we're back from Wait()
     nsresult rv =
-        PR_WaitCondVar(mCvar, interval) == PR_SUCCESS ?
+        PR_WaitCondVar("./xpcom/glue/BlockingResourceBase.cpp:372", mCvar, interval) == PR_SUCCESS ?
             NS_OK : NS_ERROR_FAILURE;
 
     // restore saved state
diff --git a/xpcom/glue/CondVar.h b/xpcom/glue/CondVar.h
--- a/xpcom/glue/CondVar.h
+++ b/xpcom/glue/CondVar.h
@@ -97,7 +97,7 @@
     nsresult Wait(PRIntervalTime interval = PR_INTERVAL_NO_TIMEOUT)
     {
         // NSPR checks for lock ownership
-        return PR_WaitCondVar(mCvar, interval) == PR_SUCCESS
+        return PR_WaitCondVar("CondVar.h", mCvar, interval) == PR_SUCCESS
             ? NS_OK : NS_ERROR_FAILURE;
     }
 #else
diff --git a/xpcom/threads/TimerThread.cpp b/xpcom/threads/TimerThread.cpp
--- a/xpcom/threads/TimerThread.cpp
+++ b/xpcom/threads/TimerThread.cpp
@@ -138,7 +138,7 @@
   else {
     PR_Lock(mLock);
     while (!mInitialized) {
-      PR_WaitCondVar(mCondVar, PR_INTERVAL_NO_TIMEOUT);
+      PR_WaitCondVar("./xpcom/threads/TimerThread.cpp:141", mCondVar, PR_INTERVAL_NO_TIMEOUT);
     }
     PR_Unlock(mLock);
   }
@@ -248,6 +248,8 @@
 {
   nsAutoLock lock(mLock);
 
+  bool first;
+
   while (!mShutdown) {
     // Have to use PRIntervalTime here, since PR_WaitCondVar takes it
     PRIntervalTime waitFor;
@@ -260,11 +262,19 @@
       TimeStamp now = TimeStamp::Now();
       nsTimerImpl *timer = nsnull;
 
+      bool first = true;
       if (!mTimers.IsEmpty()) {
         timer = mTimers[0];
 
         if (now >= timer->mTimeout + mTimeoutAdjustment) {
     next:
+          if (first) {
+            printf("TimerThread: %s\n", timer->__name__);
+            first = false;
+          } else {
+            printf("           + %s\n", timer->__name__);
+          }
+
           // NB: AddRef before the Release under RemoveTimerInternal to avoid
           // mRefCnt passing through zero, in case all other refs than the one
           // from mTimers have gone away (the last non-mTimers[i]-ref's Release
@@ -342,7 +352,7 @@
     }
 
     mWaiting = PR_TRUE;
-    PR_WaitCondVar(mCondVar, waitFor);
+    PR_WaitCondVar("./xpcom/threads/TimerThread.cpp:347", mCondVar, waitFor);
     mWaiting = PR_FALSE;
   }
 
diff --git a/xpcom/threads/nsITimer.idl b/xpcom/threads/nsITimer.idl
--- a/xpcom/threads/nsITimer.idl
+++ b/xpcom/threads/nsITimer.idl
@@ -129,7 +129,7 @@
    * @param aDelay      delay in milliseconds for timer to fire
    * @param aType       timer type per TYPE* consts defined above
    */
-  void init(in nsIObserver aObserver, in unsigned long aDelay, 
+  void init(in string aName, in nsIObserver aObserver, in unsigned long aDelay, 
             in unsigned long aType);
 
 
@@ -143,7 +143,7 @@
    * @param aDelay     The millisecond interval
    * @param aType      Timer type per TYPE* consts defined above
    */
-  [noscript] void initWithFuncCallback(in nsTimerCallbackFunc aCallback,
+  [noscript] void initWithFuncCallback(in string aName, in nsTimerCallbackFunc aCallback,
                                        in voidPtr aClosure,
                                        in unsigned long aDelay, 
                                        in unsigned long aType);
@@ -157,7 +157,7 @@
    * @param aDelay     The millisecond interval
    * @param aType      Timer type per TYPE* consts defined above
    */
-  void initWithCallback(in nsITimerCallback aCallback,
+  void initWithCallback(in string aName, in nsITimerCallback aCallback,
                         in unsigned long aDelay, 
                         in unsigned long aType);
 
diff --git a/xpcom/threads/nsTimerImpl.cpp b/xpcom/threads/nsTimerImpl.cpp
--- a/xpcom/threads/nsTimerImpl.cpp
+++ b/xpcom/threads/nsTimerImpl.cpp
@@ -139,6 +139,7 @@
 }
 
 nsTimerImpl::nsTimerImpl() :
+  __name__(NULL),
   mClosure(nsnull),
   mCallbackType(CALLBACK_TYPE_UNKNOWN),
   mFiring(PR_FALSE),
@@ -196,9 +197,10 @@
   NS_RELEASE(gThread);
 }
 
+nsresult nsTimerImpl::InitCommon(const char* aName, PRUint32 aType, PRUint32 aDelay)
+{
+  __name__ = (char*)aName;
 
-nsresult nsTimerImpl::InitCommon(PRUint32 aType, PRUint32 aDelay)
-{
   nsresult rv;
 
   NS_ENSURE_TRUE(gThread, NS_ERROR_NOT_INITIALIZED);
@@ -231,7 +233,7 @@
   return gThread->AddTimer(this);
 }
 
-NS_IMETHODIMP nsTimerImpl::InitWithFuncCallback(nsTimerCallbackFunc aFunc,
+NS_IMETHODIMP nsTimerImpl::InitWithFuncCallback(const char* aName, nsTimerCallbackFunc aFunc,
                                                 void *aClosure,
                                                 PRUint32 aDelay,
                                                 PRUint32 aType)
@@ -243,10 +245,10 @@
   mCallback.c = aFunc;
   mClosure = aClosure;
 
-  return InitCommon(aType, aDelay);
+  return InitCommon(aName, aType, aDelay);
 }
 
-NS_IMETHODIMP nsTimerImpl::InitWithCallback(nsITimerCallback *aCallback,
+NS_IMETHODIMP nsTimerImpl::InitWithCallback(const char* aName, nsITimerCallback *aCallback,
                                             PRUint32 aDelay,
                                             PRUint32 aType)
 {
@@ -257,10 +259,10 @@
   mCallback.i = aCallback;
   NS_ADDREF(mCallback.i);
 
-  return InitCommon(aType, aDelay);
+  return InitCommon(aName, aType, aDelay);
 }
 
-NS_IMETHODIMP nsTimerImpl::Init(nsIObserver *aObserver,
+NS_IMETHODIMP nsTimerImpl::Init(const char* aName, nsIObserver *aObserver,
                                 PRUint32 aDelay,
                                 PRUint32 aType)
 {
@@ -271,7 +273,7 @@
   mCallback.o = aObserver;
   NS_ADDREF(mCallback.o);
 
-  return InitCommon(aType, aDelay);
+  return InitCommon(aName, aType, aDelay);
 }
 
 NS_IMETHODIMP nsTimerImpl::Cancel()
@@ -587,7 +589,7 @@
         return NS_ERROR_OUT_OF_MEMORY;
     NS_ADDREF(timer);
 
-    nsresult rv = timer->InitWithFuncCallback(aCallback, aClosure, 
+    nsresult rv = timer->InitWithFuncCallback("<<INTERNAL>>", aCallback, aClosure, 
                                               aDelay, aType);
     if (NS_FAILED(rv)) {
         NS_RELEASE(timer);
diff --git a/xpcom/threads/nsTimerImpl.h b/xpcom/threads/nsTimerImpl.h
--- a/xpcom/threads/nsTimerImpl.h
+++ b/xpcom/threads/nsTimerImpl.h
@@ -78,6 +78,8 @@
 class nsTimerImpl : public nsITimer
 {
 public:
+  char *__name__;
+
   typedef mozilla::TimeStamp TimeStamp;
 
   nsTimerImpl();
@@ -98,7 +100,7 @@
 
 private:
   ~nsTimerImpl();
-  nsresult InitCommon(PRUint32 aType, PRUint32 aDelay);
+  nsresult InitCommon(const char* aName, PRUint32 aType, PRUint32 aDelay);
 
   void ReleaseCallback()
   {