Changeset 47572 in vbox for trunk/src/VBox/Runtime/testcase/tstR0ThreadPreemption.cpp
- Timestamp:
- Aug 7, 2013 9:51:45 AM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 87772
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/testcase/tstR0ThreadPreemption.cpp
r47521 r47572 299 299 } 300 300 301 bool fRegistered = RTThreadCtxHooksAreRegistered(NIL_RTTHREADCTX); 302 if (fRegistered) 303 { 304 RTStrPrintf(pszErr, cchErr, "!RTThreadCtxHooksAreRegistered returns true before creating any hooks"); 305 break; 306 } 307 301 308 RTTHREADCTX hThreadCtx; 302 309 int rc = RTThreadCtxHooksCreate(&hThreadCtx); … … 307 314 else 308 315 RTStrPrintf(pszErr, cchErr, "!RTThreadCtxHooksCreate returns %Rrc", rc); 316 break; 317 } 318 319 fRegistered = RTThreadCtxHooksAreRegistered(hThreadCtx); 320 if (fRegistered) 321 { 322 RTStrPrintf(pszErr, cchErr, "!RTThreadCtxHooksAreRegistered returns true before registering any hooks"); 323 RTThreadCtxHooksRelease(hThreadCtx); 309 324 break; 310 325 } … … 330 345 if (RT_FAILURE(rc)) 331 346 { 347 RTThreadPreemptRestore(&PreemptState); 332 348 RTMemFree(pCtxData); 333 349 RTStrPrintf(pszErr, cchErr, "!RTThreadCtxHooksRegister returns %Rrc", rc); … … 335 351 } 336 352 353 fRegistered = RTThreadCtxHooksAreRegistered(hThreadCtx); 354 if (!fRegistered) 355 { 356 RTThreadPreemptRestore(&PreemptState); 357 RTMemFree(pCtxData); 358 RTStrPrintf(pszErr, cchErr, "!RTThreadCtxHooksAreRegistered return false when hooks are supposedly registered"); 359 break; 360 } 361 337 362 RTThreadPreemptRestore(&PreemptState); 338 363 339 364 /* Check if the preempting callback has/will been invoked. */ 340 const uint32_t cMsTimeout = 8000;365 const uint32_t cMsTimeout = 10000; 341 366 const uint32_t cMsSleepGranularity = 50; 342 367 uint32_t cMsSlept = 0; 368 RTCPUID uCurrentCpuId = NIL_RTCPUID; 343 369 for (;;) 344 370 { 345 371 RTThreadPreemptDisable(&PreemptState); 346 const RTCPUIDuCurrentCpuId = RTMpCpuId();372 uCurrentCpuId = RTMpCpuId(); 347 373 RTThreadPreemptRestore(&PreemptState); 348 374 … … 359 385 if (!ASMAtomicReadBool(&pCtxData->fPreemptingInvoked)) 360 386 { 361 RTStrPrintf(pszErr, cchErr, "!tstR0ThreadCtxHooks[RTTHREADCTXEVENT_PREEMPTING] not invoked after ca. %u ms", 362 cMsSlept); 387 if (pCtxData->uSourceCpuId != uCurrentCpuId) 388 { 389 RTStrPrintf(pszErr, cchErr, 390 "!tstR0ThreadCtxHooks[RTTHREADCTXEVENT_PREEMPTING] not invoked before migrating from CPU %RU32 to %RU32", 391 pCtxData->uSourceCpuId, uCurrentCpuId); 392 } 393 else 394 { 395 RTStrPrintf(pszErr, cchErr, "!tstR0ThreadCtxHooks[RTTHREADCTXEVENT_PREEMPTING] not invoked after ca. %u ms", 396 cMsSlept); 397 } 363 398 } 364 399 else if (!pCtxData->fPreemptingSuccess) … … 391 426 RTThreadCtxHooksDeregister(hThreadCtx); 392 427 428 fRegistered = RTThreadCtxHooksAreRegistered(hThreadCtx); 429 if (fRegistered) 430 { 431 RTMemFree(pCtxData); 432 RTStrPrintf(pszErr, cchErr, "!RTThreadCtxHooksAreRegistered return true when hooks are deregistered"); 433 break; 434 } 435 393 436 Assert(RTThreadPreemptIsEnabled(NIL_RTTHREAD)); 394 437 uint32_t cRefs = RTThreadCtxHooksRelease(hThreadCtx);
Note:
See TracChangeset
for help on using the changeset viewer.