Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Unified Diff: nspr/pr/src/threads/prrwlock.c

Issue 170823003: Update to NSS 3.15.5 and NSPR 4.10.3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « nspr/pr/src/threads/combined/prulock.c ('k') | nss/lib/certdb/certi.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: nspr/pr/src/threads/prrwlock.c
===================================================================
--- nspr/pr/src/threads/prrwlock.c (revision 251855)
+++ nspr/pr/src/threads/prrwlock.c (working copy)
@@ -226,7 +226,8 @@
/*
* update thread's lock rank
*/
- _PR_SET_THREAD_RWLOCK_RANK(rwlock);
+ if (rwlock->rw_rank != PR_RWLOCK_RANK_NONE)
+ _PR_SET_THREAD_RWLOCK_RANK(rwlock);
#endif
}
@@ -282,7 +283,8 @@
/*
* update thread's lock rank
*/
- _PR_SET_THREAD_RWLOCK_RANK(rwlock);
+ if (rwlock->rw_rank != PR_RWLOCK_RANK_NONE)
+ _PR_SET_THREAD_RWLOCK_RANK(rwlock);
#endif
}
@@ -347,7 +349,8 @@
/*
* update thread's lock rank
*/
- _PR_UNSET_THREAD_RWLOCK_RANK(rwlock);
+ if (rwlock->rw_rank != PR_RWLOCK_RANK_NONE)
+ _PR_UNSET_THREAD_RWLOCK_RANK(rwlock);
#endif
return;
}
@@ -429,7 +432,8 @@
{
thread_rwlock_stack *lock_stack;
- if ((lock_stack = PR_GetThreadPrivate(pr_thread_rwlock_key)) == NULL)
+ lock_stack = PR_GetThreadPrivate(pr_thread_rwlock_key);
+ if (lock_stack == NULL || lock_stack->trs_index == 0)
return (PR_RWLOCK_RANK_NONE);
else
return(lock_stack->trs_stack[lock_stack->trs_index - 1]->rw_rank);
@@ -452,9 +456,8 @@
PR_ASSERT(lock_stack != NULL);
- index = lock_stack->trs_index - 1;
- while (index-- >= 0) {
- if ((lock_stack->trs_stack[index] == rwlock) && !done) {
+ for (index = lock_stack->trs_index - 1; index >= 0; index--) {
+ if (!done && (lock_stack->trs_stack[index] == rwlock)) {
/*
* reset the slot for rwlock
*/
@@ -465,7 +468,7 @@
* search for the lowest-numbered empty slot, above which there are
* no non-empty slots
*/
- if ((lock_stack->trs_stack[index] != NULL) && !new_index)
+ if (!new_index && (lock_stack->trs_stack[index] != NULL))
new_index = index + 1;
if (done && new_index)
break;
« no previous file with comments | « nspr/pr/src/threads/combined/prulock.c ('k') | nss/lib/certdb/certi.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698