Changeset 101901 in vbox
- Timestamp:
- Nov 6, 2023 8:28:48 PM (17 months ago)
- svn:sync-xref-src-repo-rev:
- 159997
- Location:
- trunk/src/libs/xpcom18a4/nsprpub/pr
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/nsprpub/pr/include/private/pprthred.h
r101899 r101901 53 53 54 54 #ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP 55 #define PR_DetachThread VBoxNsprPR_DetachThread56 #define PR_GetThreadID VBoxNsprPR_GetThreadID57 #define PR_SetThreadDumpProc VBoxNsprPR_SetThreadDumpProc58 #define PR_GetThreadAffinityMask VBoxNsprPR_GetThreadAffinityMask59 #define PR_SetThreadAffinityMask VBoxNsprPR_SetThreadAffinityMask60 #define PR_SetCPUAffinityMask VBoxNsprPR_SetCPUAffinityMask61 #define PR_ShowStatus VBoxNsprPR_ShowStatus62 #define PR_ThreadScanStackPointers VBoxNsprPR_ThreadScanStackPointers63 #define PR_ScanStackPointers VBoxNsprPR_ScanStackPointers64 #define PR_GetStackSpaceLeft VBoxNsprPR_GetStackSpaceLeft65 55 #define PR_NewNamedMonitor VBoxNsprPR_NewNamedMonitor 66 56 #define PR_TestAndLock VBoxNsprPR_TestAndLock … … 70 60 71 61 PR_BEGIN_EXTERN_C 72 73 /*---------------------------------------------------------------------------74 ** THREAD PRIVATE FUNCTIONS75 ---------------------------------------------------------------------------*/76 77 /*78 ** Get the id of the named thread. Each thread is assigned a unique id79 ** when it is created or attached.80 */81 NSPR_API(PRUint32) PR_GetThreadID(PRThread *thread);82 83 /*84 ** Set the procedure that is called when a thread is dumped. The procedure85 ** will be applied to the argument, arg, when called. Setting the procedure86 ** to NULL effectively removes it.87 */88 typedef void (*PRThreadDumpProc)(PRFileDesc *fd, PRThread *t, void *arg);89 NSPR_API(void) PR_SetThreadDumpProc(90 PRThread* thread, PRThreadDumpProc dump, void *arg);91 92 /*93 ** Get this thread's affinity mask. The affinity mask is a 32 bit quantity94 ** marking a bit for each processor this process is allowed to run on.95 ** The processor mask is returned in the mask argument.96 ** The least-significant-bit represents processor 0.97 **98 ** Returns 0 on success, -1 on failure.99 */100 NSPR_API(PRInt32) PR_GetThreadAffinityMask(PRThread *thread, PRUint32 *mask);101 102 /*103 ** Set this thread's affinity mask.104 **105 ** Returns 0 on success, -1 on failure.106 */107 NSPR_API(PRInt32) PR_SetThreadAffinityMask(PRThread *thread, PRUint32 mask );108 109 /*110 ** Set the default CPU Affinity mask.111 **112 */113 NSPR_API(PRInt32) PR_SetCPUAffinityMask(PRUint32 mask);114 115 62 116 63 /*--------------------------------------------------------------------------- -
trunk/src/libs/xpcom18a4/nsprpub/pr/include/private/primpl.h
r101874 r101901 394 394 /************************************************************************/ 395 395 396 /* XXX this needs to be exported (sigh) */397 struct PRThreadStack {398 PRCList links;399 PRUintn flags;400 401 char *allocBase; /* base of stack's allocated memory */402 PRUint32 allocSize; /* size of stack's allocated memory */403 char *stackBottom; /* bottom of stack from C's point of view */404 char *stackTop; /* top of stack from C's point of view */405 PRUint32 stackSize; /* size of usable portion of the stack */406 407 PRSegment *seg;408 PRThread* thr; /* back pointer to thread owning this stack */409 };410 411 396 extern void _PR_DestroyThreadPrivate(PRThread*); 412 397 … … 420 405 _PRStartFn startFunc; /* the root of the client's thread */ 421 406 422 PRThreadStack *stack; /* info about thread's stack (for GC) */423 407 void *environment; /* pointer to execution environment */ 424 425 PRThreadDumpProc dump; /* dump thread info out */426 void *dumpArg; /* argument for the dump function */427 408 428 409 /* -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptthread.c
r101900 r101901 88 88 #endif 89 89 90 /*91 ** Initialize a stack for a native pthread thread92 */93 static void _PR_InitializeStack(PRThreadStack *ts)94 {95 if( ts && (ts->stackTop == 0) ) {96 ts->allocBase = (char *) &ts;97 ts->allocSize = ts->stackSize;98 99 /*100 ** Setup stackTop and stackBottom values.101 */102 #ifdef HAVE_STACK_GROWING_UP103 ts->stackBottom = ts->allocBase + ts->stackSize;104 ts->stackTop = ts->allocBase;105 #else106 ts->stackTop = ts->allocBase;107 ts->stackBottom = ts->allocBase - ts->stackSize;108 #endif109 }110 }111 112 90 static void *_pt_root(void *arg) 113 91 { … … 126 104 */ 127 105 thred->id = pthread_self(); 128 129 /* Set up the thread stack information */130 _PR_InitializeStack(thred->stack);131 106 132 107 /* … … 303 278 304 279 thred->suspend =(isGCAble) ? PT_THREAD_SETGCABLE : 0; 305 306 thred->stack = PR_NEWZAP(PRThreadStack);307 if (thred->stack == NULL) {308 PRIntn oserr = errno;309 PR_Free(thred); /* all that work ... poof! */310 PR_SetError(PR_OUT_OF_MEMORY_ERROR, oserr);311 thred = NULL; /* and for what? */312 goto done;313 }314 thred->stack->stackSize = stackSize;315 thred->stack->thr = thred;316 280 317 281 #ifdef PT_NO_SIGTIMEDWAIT … … 349 313 PR_Unlock(pt_book.ml); 350 314 351 PR_Free(thred->stack);352 315 PR_Free(thred); /* all that work ... poof! */ 353 316 PR_SetError(PR_INSUFFICIENT_RESOURCES_ERROR, oserr); … … 595 558 if (NULL != thred->errorString) 596 559 PR_Free(thred->errorString); 597 PR_Free(thred->stack);598 560 if (NULL != thred->syspoll_list) 599 561 PR_Free(thred->syspoll_list); … … 660 622 thred->next = thred->prev = NULL; 661 623 pt_book.first = pt_book.last = thred; 662 663 thred->stack = PR_NEWZAP(PRThreadStack);664 PR_ASSERT(thred->stack != NULL);665 thred->stack->stackSize = 0;666 thred->stack->thr = thred;667 _PR_InitializeStack(thred->stack);668 624 669 625 /*
Note:
See TracChangeset
for help on using the changeset viewer.