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

Side by Side 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, 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public 2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 5
6 #include "primpl.h" 6 #include "primpl.h"
7 #include <signal.h> 7 #include <signal.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #if defined(WIN95) 10 #if defined(WIN95)
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 if (thread->privateData) { 230 if (thread->privateData) {
231 unsigned int i; 231 unsigned int i;
232 for (i = 0; i < thread->tpdLength; i++) { 232 for (i = 0; i < thread->tpdLength; i++) {
233 PR_ASSERT(thread->privateData[i] == NULL); 233 PR_ASSERT(thread->privateData[i] == NULL);
234 } 234 }
235 } 235 }
236 #endif 236 #endif
237 PR_ASSERT(thread->dumpArg == 0 && thread->dump == 0); 237 PR_ASSERT(thread->dumpArg == 0 && thread->dump == 0);
238 PR_ASSERT(thread->errorString == 0 && thread->errorStringSize == 0); 238 PR_ASSERT(thread->errorString == 0 && thread->errorStringSize == 0);
239 PR_ASSERT(thread->errorStringLength == 0); 239 PR_ASSERT(thread->errorStringLength == 0);
240 PR_ASSERT(thread->name == 0);
240 241
241 /* Reset data members in thread structure */ 242 /* Reset data members in thread structure */
242 thread->errorCode = thread->osErrorCode = 0; 243 thread->errorCode = thread->osErrorCode = 0;
243 thread->io_pending = thread->io_suspended = PR_FALSE; 244 thread->io_pending = thread->io_suspended = PR_FALSE;
244 thread->environment = 0; 245 thread->environment = 0;
245 PR_INIT_CLIST(&thread->lockList); 246 PR_INIT_CLIST(&thread->lockList);
246 } 247 }
247 248
248 PRStatus _PR_RecycleThread(PRThread *thread) 249 PRStatus _PR_RecycleThread(PRThread *thread)
249 { 250 {
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 } else if ((PRIntn)newPri < (PRIntn)PR_PRIORITY_FIRST) { 1575 } else if ((PRIntn)newPri < (PRIntn)PR_PRIORITY_FIRST) {
1575 newPri = PR_PRIORITY_FIRST; 1576 newPri = PR_PRIORITY_FIRST;
1576 } 1577 }
1577 1578
1578 if ( _PR_IS_NATIVE_THREAD(thread) ) { 1579 if ( _PR_IS_NATIVE_THREAD(thread) ) {
1579 thread->priority = newPri; 1580 thread->priority = newPri;
1580 _PR_MD_SET_PRIORITY(&(thread->md), newPri); 1581 _PR_MD_SET_PRIORITY(&(thread->md), newPri);
1581 } else _PR_SetThreadPriority(thread, newPri); 1582 } else _PR_SetThreadPriority(thread, newPri);
1582 } 1583 }
1583 1584
1585 PR_IMPLEMENT(PRStatus) PR_SetCurrentThreadName(const char *name)
1586 {
1587 PRThread *thread;
1588 size_t nameLen;
1589
1590 if (!name) {
1591 PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
1592 return PR_FAILURE;
1593 }
1594
1595 thread = PR_GetCurrentThread();
1596 if (!thread)
1597 return PR_FAILURE;
1598
1599 PR_Free(thread->name);
1600 nameLen = strlen(name);
1601 thread->name = (char *)PR_Malloc(nameLen + 1);
1602 if (!thread->name)
1603 return PR_FAILURE;
1604 memcpy(thread->name, name, nameLen + 1);
1605 _PR_MD_SET_CURRENT_THREAD_NAME(thread->name);
1606 return PR_SUCCESS;
1607 }
1608
1609 PR_IMPLEMENT(const char *) PR_GetThreadName(const PRThread *thread)
1610 {
1611 if (!thread)
1612 return NULL;
1613 return thread->name;
1614 }
1615
1584 1616
1585 /* 1617 /*
1586 ** This routine prevents all other threads from running. This call is needed by 1618 ** This routine prevents all other threads from running. This call is needed by
1587 ** the garbage collector. 1619 ** the garbage collector.
1588 */ 1620 */
1589 PR_IMPLEMENT(void) PR_SuspendAll(void) 1621 PR_IMPLEMENT(void) PR_SuspendAll(void)
1590 { 1622 {
1591 PRThread *me = _PR_MD_CURRENT_THREAD(); 1623 PRThread *me = _PR_MD_CURRENT_THREAD();
1592 PRCList *qp; 1624 PRCList *qp;
1593 1625
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1846 _PR_RUNQ_LOCK(cpu); 1878 _PR_RUNQ_LOCK(cpu);
1847 _PR_ADD_RUNQ(thread, cpu, pri); 1879 _PR_ADD_RUNQ(thread, cpu, pri);
1848 _PR_RUNQ_UNLOCK(cpu); 1880 _PR_RUNQ_UNLOCK(cpu);
1849 if (!_PR_IS_NATIVE_THREAD(me) && (cpu == me->cpu)) { 1881 if (!_PR_IS_NATIVE_THREAD(me) && (cpu == me->cpu)) {
1850 if (pri > me->priority) { 1882 if (pri > me->priority) {
1851 _PR_SET_RESCHED_FLAG(); 1883 _PR_SET_RESCHED_FLAG();
1852 } 1884 }
1853 } 1885 }
1854 #endif 1886 #endif
1855 } 1887 }
OLDNEW
« 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