Changeset 102392 in vbox
- Timestamp:
- Nov 30, 2023 12:55:29 PM (14 months ago)
- Location:
- trunk/src/libs/xpcom18a4
- Files:
-
- 14 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/Makefile.kmk
r102390 r102392 158 158 nsprpub/pr/include/prbit.h \ 159 159 nsprpub/pr/include/prclist.h \ 160 nsprpub/pr/include/prinrval.h \ 160 161 nsprpub/pr/include/prlong.h \ 161 162 nsprpub/pr/include/prmem.h \ … … 385 386 $(VBox-xpcom-nspr_0_OUTDIR) 386 387 VBox-xpcom-nspr_SOURCES = \ 388 nsprpub/pr/src/misc/prinrval.c \ 387 389 nsprpub/lib/ds/plarena.c \ 388 390 nsprpub/lib/ds/plhash.c \ -
trunk/src/libs/xpcom18a4/ipc/ipcd/client/public/ipcdclient.h
r102390 r102392 54 54 #include "ipcIClientObserver.h" 55 55 56 #include <iprt/types.h>56 #include "prinrval.h" 57 57 58 58 /* This API is only provided for the extensions compiled into the IPCDC … … 240 240 ipcIMessageObserver *aObserver = nsnull, 241 241 ipcIMessageObserver *aConsumer = nsnull, 242 RTMSINTERVAL aTimeout = RT_INDEFINITE_WAIT242 PRIntervalTime aTimeout = PR_INTERVAL_NO_TIMEOUT 243 243 ); 244 244 -
trunk/src/libs/xpcom18a4/ipc/ipcd/client/src/ipcService.cpp
r102390 r102392 105 105 { 106 106 return IPC_WaitMessage(aSenderID, aTarget, aObserver, nsnull, 107 aTimeout);107 PR_MillisecondsToInterval(aTimeout)); 108 108 } 109 109 -
trunk/src/libs/xpcom18a4/ipc/ipcd/client/src/ipcdclient.cpp
r102390 r102392 66 66 /* ------------------------------------------------------------------------- */ 67 67 68 #define IPC_REQUEST_TIMEOUT (30 * RT_MS_1SEC)68 #define IPC_REQUEST_TIMEOUT PR_SecondsToInterval(30) 69 69 70 70 /* ------------------------------------------------------------------------- */ … … 307 307 static nsresult 308 308 WaitTarget(const nsID &aTarget, 309 RTMSINTERVALaTimeout,309 PRIntervalTime aTimeout, 310 310 ipcMessage **aMsg, 311 311 ipcMessageSelector aSelector = nsnull, … … 323 323 PRBool isIPCMTarget = aTarget.Equals(IPCM_TARGET); 324 324 325 uint64_t timeStart = RTTimeMilliTS();326 uint64_ttimeEnd;327 if (aTimeout == RT_INDEFINITE_WAIT)325 PRIntervalTime timeStart = PR_IntervalNow(); 326 PRIntervalTime timeEnd; 327 if (aTimeout == PR_INTERVAL_NO_TIMEOUT) 328 328 timeEnd = aTimeout; 329 else if (aTimeout == 0)329 else if (aTimeout == PR_INTERVAL_NO_WAIT) 330 330 timeEnd = timeStart; 331 331 else … … 335 335 // if overflowed, then set to max value 336 336 if (timeEnd < timeStart) 337 timeEnd = RT_INDEFINITE_WAIT;337 timeEnd = PR_INTERVAL_NO_TIMEOUT; 338 338 } 339 339 … … 440 440 #endif /* VBOX */ 441 441 442 uint64_t t = RTTimeMilliTS();442 PRIntervalTime t = PR_IntervalNow(); 443 443 if (t > timeEnd) // check if timeout has expired 444 444 { … … 1081 1081 ipcIMessageObserver *aObserver, 1082 1082 ipcIMessageObserver *aConsumer, 1083 RTMSINTERVALaTimeout)1083 PRIntervalTime aTimeout) 1084 1084 { 1085 1085 NS_ENSURE_TRUE(gClientState, NS_ERROR_NOT_INITIALIZED); -
trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.cpp
r102390 r102392 96 96 //----------------------------------------------------------------------------- 97 97 98 #define DCON_WAIT_TIMEOUT RT_INDEFINITE_WAIT98 #define DCON_WAIT_TIMEOUT PR_INTERVAL_NO_TIMEOUT 99 99 100 100 //----------------------------------------------------------------------------- … … 1281 1281 { 1282 1282 uClient = aClient; 1283 uTimestamp = RTTimeMilliTS();1283 uTimestamp = PR_IntervalNow(); 1284 1284 } 1285 1285 1286 1286 PRUint32 uClient; 1287 uint64_tuTimestamp;1287 PRIntervalTime uTimestamp; 1288 1288 } ClientDownInfo; 1289 1289 typedef std::map<PRUint32, ClientDownInfo *> ClientDownMap; … … 1326 1326 // Insert new client down information. Start by expiring outdated 1327 1327 // entries and free one element if there's still no space (if needed). 1328 uint64_t now = RTTimeMilliTS();1328 PRIntervalTime now = PR_IntervalNow(); 1329 1329 while (!g_ClientDownList.empty()) 1330 1330 { … … 1332 1332 PRInt64 diff = (PRInt64)now - cInfo->uTimestamp; 1333 1333 if (diff < 0) 1334 diff += (PRInt64)(( uint64_t)-1) + 1;1335 if (diff > 15 * 60 * RT_MS_1SEC)1334 diff += (PRInt64)((PRIntervalTime)-1) + 1; 1335 if (diff > PR_SecondsToInterval(15 * 60)) 1336 1336 { 1337 1337 g_ClientDownMap.erase(cInfo->uClient); … … 3557 3557 mon.Exit(); 3558 3558 { 3559 PRUint32 ticks = PR_MillisecondsToInterval(PR_MIN(mWorkers.Count() / 20 + 1, 10)); 3559 3560 nsAutoMonitor workersMon(mWaitingWorkersMon); 3560 workersMon.Wait( PR_MIN(mWorkers.Count() / 20 + 1, 10));3561 workersMon.Wait(ticks); 3561 3562 } 3562 3563 mon.Enter(); -
trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/lock/src/ipcLockService.cpp
r102390 r102392 109 109 do { 110 110 // block the calling thread until we get a response from the daemon 111 rv = IPC_WaitMessage(0, kLockTargetID, this, nsnull, RT_INDEFINITE_WAIT);111 rv = IPC_WaitMessage(0, kLockTargetID, this, nsnull, PR_INTERVAL_NO_TIMEOUT); 112 112 } 113 113 while (NS_SUCCEEDED(rv) && !pendingLock.complete); -
trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/transmngr/src/tmTransactionService.cpp
r102390 r102392 328 328 aTrans->GetRawMessageLength()); 329 329 if (aSync) 330 IPC_WaitMessage(0, kTransModuleID, nsnull, nsnull, RT_INDEFINITE_WAIT);330 IPC_WaitMessage(0, kTransModuleID, nsnull, nsnull, PR_INTERVAL_NO_TIMEOUT); 331 331 } 332 332 -
trunk/src/libs/xpcom18a4/nsprpub/pr/include/nspr.h
r102390 r102392 45 45 #include "prbit.h" 46 46 #include "prclist.h" 47 #include "prinrval.h" 47 48 #include "prlong.h" 48 49 #include "prmem.h" -
trunk/src/libs/xpcom18a4/nsprpub/pr/include/prbit.h
r102390 r102392 46 46 47 47 /* 48 ** A prbitmap_t is a long integer that can be used for bitmaps 49 */ 50 typedef unsigned long prbitmap_t; 51 52 #define PR_TEST_BIT(_map,_bit) \ 53 ((_map)[(_bit)>>PR_BITS_PER_LONG_LOG2] & (1L << ((_bit) & (PR_BITS_PER_LONG-1)))) 54 #define PR_SET_BIT(_map,_bit) \ 55 ((_map)[(_bit)>>PR_BITS_PER_LONG_LOG2] |= (1L << ((_bit) & (PR_BITS_PER_LONG-1)))) 56 #define PR_CLEAR_BIT(_map,_bit) \ 57 ((_map)[(_bit)>>PR_BITS_PER_LONG_LOG2] &= ~(1L << ((_bit) & (PR_BITS_PER_LONG-1)))) 58 59 /* 48 60 ** Compute the log of the least power of 2 greater than or equal to n 49 61 */ … … 88 100 } 89 101 102 /* 103 ** Macro version of PR_CeilingLog2: Compute the log of the least power of 104 ** 2 greater than or equal to _n. The result is returned in _log2. 105 */ 106 #define PR_CEILING_LOG2(_log2,_n) \ 107 PR_BEGIN_MACRO \ 108 PRUint32 j_ = (PRUint32)(_n); \ 109 (_log2) = 0; \ 110 if ((j_) & ((j_)-1)) \ 111 (_log2) += 1; \ 112 if ((j_) >> 16) \ 113 (_log2) += 16, (j_) >>= 16; \ 114 if ((j_) >> 8) \ 115 (_log2) += 8, (j_) >>= 8; \ 116 if ((j_) >> 4) \ 117 (_log2) += 4, (j_) >>= 4; \ 118 if ((j_) >> 2) \ 119 (_log2) += 2, (j_) >>= 2; \ 120 if ((j_) >> 1) \ 121 (_log2) += 1; \ 122 PR_END_MACRO 123 124 /* 125 ** Macro version of PR_FloorLog2: Compute the log of the greatest power of 126 ** 2 less than or equal to _n. The result is returned in _log2. 127 ** 128 ** This is equivalent to finding the highest set bit in the word. 129 */ 130 #define PR_FLOOR_LOG2(_log2,_n) \ 131 PR_BEGIN_MACRO \ 132 PRUint32 j_ = (PRUint32)(_n); \ 133 (_log2) = 0; \ 134 if ((j_) >> 16) \ 135 (_log2) += 16, (j_) >>= 16; \ 136 if ((j_) >> 8) \ 137 (_log2) += 8, (j_) >>= 8; \ 138 if ((j_) >> 4) \ 139 (_log2) += 4, (j_) >>= 4; \ 140 if ((j_) >> 2) \ 141 (_log2) += 2, (j_) >>= 2; \ 142 if ((j_) >> 1) \ 143 (_log2) += 1; \ 144 PR_END_MACRO 145 90 146 PR_END_EXTERN_C 91 92 147 #endif /* prbit_h___ */ -
trunk/src/libs/xpcom18a4/nsprpub/pr/include/prmon.h
r102390 r102392 40 40 41 41 #include "prtypes.h" 42 43 #include <iprt/types.h> 42 #include "prinrval.h" 44 43 45 44 #ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP … … 106 105 ** Returns PR_FAILURE if the caller has not entered the monitor. 107 106 */ 108 NSPR_API(PRStatus) PR_Wait(PRMonitor *mon, RTMSINTERVAL msWait);107 NSPR_API(PRStatus) PR_Wait(PRMonitor *mon, PRIntervalTime ticks); 109 108 110 109 /* -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptsynch.c
r102390 r102392 285 285 286 286 static PRIntn pt_TimedWait( 287 pthread_cond_t *cv, pthread_mutex_t *ml, RTMSINTERVAL msTimeout)287 pthread_cond_t *cv, pthread_mutex_t *ml, PRIntervalTime timeout) 288 288 { 289 289 int rv; 290 290 struct timeval now; 291 291 struct timespec tmo; 292 293 tmo.tv_sec = (PRInt32)(msTimeout / RT_MS_1SEC); 294 tmo.tv_nsec = (PRInt32)((msTimeout - (tmo.tv_sec * RT_MS_1SEC)) * RT_NS_1MS); 292 PRUint32 ticks = PR_TicksPerSecond(); 293 294 tmo.tv_sec = (PRInt32)(timeout / ticks); 295 tmo.tv_nsec = (PRInt32)(timeout - (tmo.tv_sec * ticks)); 296 tmo.tv_nsec = (PRInt32)PR_IntervalToMicroseconds(PT_NANOPERMICRO * tmo.tv_nsec); 295 297 296 298 /* pthreads wants this in absolute time, off we go ... */ … … 365 367 } /* PR_DestroyCondVar */ 366 368 367 PR_IMPLEMENT(PRStatus) PR_WaitCondVar(PRCondVar *cvar, RTMSINTERVAL msTimeout)369 PR_IMPLEMENT(PRStatus) PR_WaitCondVar(PRCondVar *cvar, PRIntervalTime timeout) 368 370 { 369 371 PRIntn rv; … … 392 394 cvar->lock->locked = PR_FALSE; 393 395 394 if ( msTimeout == RT_INDEFINITE_WAIT)396 if (timeout == PR_INTERVAL_NO_TIMEOUT) 395 397 rv = pthread_cond_wait(&cvar->cv, &cvar->lock->mutex); 396 398 else 397 rv = pt_TimedWait(&cvar->cv, &cvar->lock->mutex, msTimeout);399 rv = pt_TimedWait(&cvar->cv, &cvar->lock->mutex, timeout); 398 400 399 401 /* We just got the lock back - this better be empty */ … … 543 545 } /* PR_ExitMonitor */ 544 546 545 PR_IMPLEMENT(PRStatus) PR_Wait(PRMonitor *mon, RTMSINTERVAL msTimeout)547 PR_IMPLEMENT(PRStatus) PR_Wait(PRMonitor *mon, PRIntervalTime timeout) 546 548 { 547 549 PRStatus rv; … … 563 565 _PT_PTHREAD_INVALIDATE_THR_HANDLE(mon->owner); 564 566 565 rv = PR_WaitCondVar(mon->cvar, msTimeout);567 rv = PR_WaitCondVar(mon->cvar, timeout); 566 568 567 569 /* reinstate the intresting information */ -
trunk/src/libs/xpcom18a4/xpcom/reflect/xptcall/tests/TestXPTCInvoke.cpp
r102390 r102392 44 44 #include "xptcall.h" 45 45 #include "prlong.h" 46 #include "prinrval.h" 46 47 #include "nsMemory.h" 47 48 … … 53 54 54 55 #include <iprt/string.h> 55 #include <iprt/time.h>56 56 57 57 static char g_szDirect[16384]; … … 1438 1438 static const int count = 100000000; 1439 1439 int i; 1440 uint64_tstart;1441 uint64_tinterval_direct;1442 uint64_tinterval_invoke;1440 PRIntervalTime start; 1441 PRIntervalTime interval_direct; 1442 PRIntervalTime interval_invoke; 1443 1443 1444 1444 printf("Speed test...\n\n"); 1445 1445 printf("Doing %d direct call iterations...\n", count); 1446 start = RTTimeNanoTS();1446 start = PR_IntervalNow(); 1447 1447 for(i = count; i; i--) 1448 1448 (void)test->AddTwoInts(in1, in2, &out); 1449 interval_direct = RTTimeNanoTS() - start;1449 interval_direct = PR_IntervalNow() - start; 1450 1450 1451 1451 printf("Doing %d invoked call iterations...\n", count); 1452 start = RTTimeNanoTS();1452 start = PR_IntervalNow(); 1453 1453 for(i = count; i; i--) 1454 1454 (void)XPTC_InvokeByIndex(test, 3, 3, var); 1455 interval_invoke = RTTimeNanoTS() - start;1455 interval_invoke = PR_IntervalNow() - start; 1456 1456 1457 1457 printf(" direct took %0.2f seconds\n", 1458 (double)interval_direct/(double) RT_NS_1SEC);1458 (double)interval_direct/(double)PR_TicksPerSecond()); 1459 1459 printf(" invoke took %0.2f seconds\n", 1460 (double)interval_invoke/(double) RT_NS_1SEC);1460 (double)interval_invoke/(double)PR_TicksPerSecond()); 1461 1461 printf(" So, invoke overhead was ~ %0.2f seconds (~ %0.0f%%)\n", 1462 (double)(interval_invoke-interval_direct)/(double) RT_NS_1SEC,1462 (double)(interval_invoke-interval_direct)/(double)PR_TicksPerSecond(), 1463 1463 (double)(interval_invoke-interval_direct)/(double)interval_invoke*100); 1464 1464 } -
trunk/src/libs/xpcom18a4/xpcom/threads/nsAutoLock.h
r102390 r102392 257 257 * @see prmon.h 258 258 **/ 259 nsresult Wait( RTMSINTERVAL msTimeout = RT_INDEFINITE_WAIT) {260 return PR_Wait(mMonitor, msTimeout) == PR_SUCCESS259 nsresult Wait(PRIntervalTime interval = PR_INTERVAL_NO_TIMEOUT) { 260 return PR_Wait(mMonitor, interval) == PR_SUCCESS 261 261 ? NS_OK : NS_ERROR_FAILURE; 262 262 } -
trunk/src/libs/xpcom18a4/xpcom/threads/plevent.c
r102390 r102392 637 637 PRStatus err; 638 638 Log(("$$$ waiting for event")); 639 err = PR_Wait(mon, RT_INDEFINITE_WAIT);639 err = PR_Wait(mon, PR_INTERVAL_NO_TIMEOUT); 640 640 } 641 641
Note:
See TracChangeset
for help on using the changeset viewer.