| diff -aruN nspr-4.8.6/mozilla/nsprpub/pr/include/prlock.h nspr-4.8.6.N/mozilla/nsprpub/pr/include/prlock.h |
| --- nspr-4.8.6/mozilla/nsprpub/pr/include/prlock.h 2009-03-18 14:29:29.000000000 -0700 |
| +++ nspr-4.8.6.N/mozilla/nsprpub/pr/include/prlock.h 2016-08-26 08:21:19.494206783 -0700 |
| @@ -117,6 +117,18 @@ |
| NSPR_API(PRStatus) PR_Unlock(PRLock *lock); |
| |
| /*********************************************************************** |
| +** FUNCTION: PR_IsLocked |
| +** DESCRIPTION: |
| +** Determine if a lock is locked. |
| +** INPUTS: PRLock *lock |
| +** Lock to determine. |
| +** OUTPUTS: void |
| +** RETURN: PRBool |
| +** Returns PR_TRUE if lock is locked, else PR_FALSE. |
| +***********************************************************************/ |
| +NSPR_API(PRBool) PR_IsLocked(PRLock *lock); |
| + |
| +/*********************************************************************** |
| ** MACRO: PR_ASSERT_CURRENT_THREAD_OWNS_LOCK |
| ** DESCRIPTION: |
| ** If the current thread owns |lock|, this assertion is guaranteed to |
| diff -aruN nspr-4.8.6/mozilla/nsprpub/pr/src/pthreads/ptsynch.c nspr-4.8.6.N/mozilla/nsprpub/pr/src/pthreads/ptsynch.c |
| --- nspr-4.8.6/mozilla/nsprpub/pr/src/pthreads/ptsynch.c 2010-07-11 10:14:39.000000000 -0700 |
| +++ nspr-4.8.6.N/mozilla/nsprpub/pr/src/pthreads/ptsynch.c 2016-08-26 08:12:02.026296557 -0700 |
| @@ -245,6 +245,12 @@ |
| return PR_SUCCESS; |
| } /* PR_Unlock */ |
| |
| +PR_IMPLEMENT(PRBool) PR_IsLocked(PRLock *lock) |
| +{ |
| + PR_ASSERT(lock != NULL); |
| + return lock->locked; |
| +} |
| + |
| PR_IMPLEMENT(void) PR_AssertCurrentThreadOwnsLock(PRLock *lock) |
| { |
| /* Nb: the order of the |locked| and |owner==me| checks is not critical |