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

Unified Diff: nspr/pr/src/pthreads/ptthread.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/pthreads/ptio.c ('k') | nspr/pr/src/threads/combined/prulock.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: nspr/pr/src/pthreads/ptthread.c
===================================================================
--- nspr/pr/src/pthreads/ptthread.c (revision 251855)
+++ nspr/pr/src/pthreads/ptthread.c (working copy)
@@ -52,6 +52,7 @@
PRInt32 system, user; /* a count of the two different types */
PRUintn this_many; /* number of threads allowed for exit */
pthread_key_t key; /* thread private data key */
+ PRBool keyCreated; /* whether 'key' should be deleted */
PRThread *first, *last; /* list of threads we know about */
#if defined(_PR_DCETHREADS) || defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
PRInt32 minPrio, maxPrio; /* range of scheduling priorities */
@@ -979,9 +980,11 @@
* nothing.
*/
rv = _PT_PTHREAD_KEY_CREATE(&pt_book.key, _pt_thread_death);
+ if (0 != rv)
+ PR_Assert("0 == rv", __FILE__, __LINE__);
+ pt_book.keyCreated = PR_TRUE;
+ rv = pthread_setspecific(pt_book.key, thred);
PR_ASSERT(0 == rv);
- rv = pthread_setspecific(pt_book.key, thred);
- PR_ASSERT(0 == rv);
} /* _PR_InitThreads */
#ifdef __GNUC__
@@ -1041,7 +1044,17 @@
void *thred;
int rv;
- if (!_pr_initialized) return;
+ if (!_pr_initialized) {
+ /* Either NSPR was never successfully initialized or
+ * PR_Cleanup has been called already. */
+ if (pt_book.keyCreated)
+ {
+ rv = pthread_key_delete(pt_book.key);
+ PR_ASSERT(0 == rv);
+ pt_book.keyCreated = PR_FALSE;
+ }
+ return;
+ }
_PT_PTHREAD_GETSPECIFIC(pt_book.key, thred);
if (NULL != thred)
@@ -1056,6 +1069,7 @@
}
rv = pthread_key_delete(pt_book.key);
PR_ASSERT(0 == rv);
+ pt_book.keyCreated = PR_FALSE;
/* TODO: free other resources used by NSPR */
/* _pr_initialized = PR_FALSE; */
} /* _PR_Fini */
« no previous file with comments | « nspr/pr/src/pthreads/ptio.c ('k') | nspr/pr/src/threads/combined/prulock.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698