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

Unified Diff: mozilla/nsprpub/pr/src/threads/combined/pruthr.c

Issue 12089033: Update to NSPR 4.9.5 Beta 2, part 2: actual changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Created 7 years, 11 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 | « mozilla/nsprpub/pr/src/pthreads/ptthread.c ('k') | mozilla/nsprpub/pr/src/threads/prcthr.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mozilla/nsprpub/pr/src/threads/combined/pruthr.c
===================================================================
--- mozilla/nsprpub/pr/src/threads/combined/pruthr.c (revision 179237)
+++ mozilla/nsprpub/pr/src/threads/combined/pruthr.c (working copy)
@@ -237,6 +237,7 @@
PR_ASSERT(thread->dumpArg == 0 && thread->dump == 0);
PR_ASSERT(thread->errorString == 0 && thread->errorStringSize == 0);
PR_ASSERT(thread->errorStringLength == 0);
+ PR_ASSERT(thread->name == 0);
/* Reset data members in thread structure */
thread->errorCode = thread->osErrorCode = 0;
@@ -1581,7 +1582,38 @@
} else _PR_SetThreadPriority(thread, newPri);
}
+PR_IMPLEMENT(PRStatus) PR_SetCurrentThreadName(const char *name)
+{
+ PRThread *thread;
+ size_t nameLen;
+ if (!name) {
+ PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
+ return PR_FAILURE;
+ }
+
+ thread = PR_GetCurrentThread();
+ if (!thread)
+ return PR_FAILURE;
+
+ PR_Free(thread->name);
+ nameLen = strlen(name);
+ thread->name = (char *)PR_Malloc(nameLen + 1);
+ if (!thread->name)
+ return PR_FAILURE;
+ memcpy(thread->name, name, nameLen + 1);
+ _PR_MD_SET_CURRENT_THREAD_NAME(thread->name);
+ return PR_SUCCESS;
+}
+
+PR_IMPLEMENT(const char *) PR_GetThreadName(const PRThread *thread)
+{
+ if (!thread)
+ return NULL;
+ return thread->name;
+}
+
+
/*
** This routine prevents all other threads from running. This call is needed by
** the garbage collector.
« no previous file with comments | « mozilla/nsprpub/pr/src/pthreads/ptthread.c ('k') | mozilla/nsprpub/pr/src/threads/prcthr.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698