Changeset 101983 in vbox
- Timestamp:
- Nov 8, 2023 3:34:44 PM (15 months ago)
- Location:
- trunk/src/libs/xpcom18a4/nsprpub/pr/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/nsprpub/pr/src/misc/prinit.c
r101969 r101983 66 66 PRFileDesc *_pr_stderr; 67 67 68 PRLock *_pr_sleeplock; /* used in PR_Sleep(), classic and pthreads */69 70 68 PRBool _pr_initialized = PR_FALSE; 71 69 … … 104 102 _PR_InitLocks(); 105 103 _PR_InitClock(); 106 107 _pr_sleeplock = PR_NewLock();108 PR_ASSERT(NULL != _pr_sleeplock);109 104 110 105 _PR_InitThreads(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptthread.c
r101968 r101983 63 63 64 64 static PRIntn pt_schedpriv = 0; 65 extern PRLock *_pr_sleeplock;66 65 67 66 static struct _PT_Bookeeping … … 508 507 } /* PR_Interrupt */ 509 508 510 PR_IMPLEMENT(PRStatus) PR_Sleep(PRIntervalTime ticks)511 {512 PRStatus rv = PR_SUCCESS;513 514 if (!_pr_initialized) _PR_ImplicitInitialization();515 516 if (PR_INTERVAL_NO_WAIT == ticks)517 {518 _PT_PTHREAD_YIELD();519 }520 else521 {522 PRCondVar *cv;523 PRIntervalTime timein;524 525 timein = PR_IntervalNow();526 cv = PR_NewCondVar(_pr_sleeplock);527 PR_ASSERT(cv != NULL);528 PR_Lock(_pr_sleeplock);529 do530 {531 PRIntervalTime now = PR_IntervalNow();532 PRIntervalTime delta = now - timein;533 if (delta > ticks) break;534 rv = PR_WaitCondVar(cv, ticks - delta);535 } while (PR_SUCCESS == rv);536 PR_Unlock(_pr_sleeplock);537 PR_DestroyCondVar(cv);538 }539 return rv;540 } /* PR_Sleep */541 542 509 static void _pt_thread_death(void *arg) 543 510 { … … 673 640 } 674 641 _pt_thread_death(me); 675 PR_DestroyLock(_pr_sleeplock); 676 _pr_sleeplock = NULL; 642 677 643 _pr_initialized = PR_FALSE; 678 644 return PR_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.