| 410 | } |
| 411 | |
| 412 | void btParallelFor(int iBegin, int iEnd, int grainSize, const btIParallelForBody& body) |
| 413 | { |
| 414 | #if BT_THREADSAFE |
| 415 | |
| 416 | #if BT_DETECT_BAD_THREAD_INDEX |
| 417 | if (!btThreadsAreRunning()) |
| 418 | { |
| 419 | // clear out thread ids |
| 420 | for (int i = 0; i < BT_MAX_THREAD_COUNT; ++i) |
| 421 | { |
| 422 | gDebugThreadIds[i] = kInvalidThreadId; |
| 423 | } |
| 424 | } |
| 425 | #endif // #if BT_DETECT_BAD_THREAD_INDEX |
| 426 | |
| 427 | btAssert(gBtTaskScheduler != NULL); // call btSetTaskScheduler() with a valid task scheduler first! |
| 428 | gBtTaskScheduler->parallelFor(iBegin, iEnd, grainSize, body); |
| 429 | |
| 430 | #else // #if BT_THREADSAFE |
| 431 | |
| 432 | // non-parallel version of btParallelFor |
| 433 | btAssert(!"called btParallelFor in non-threadsafe build. enable BT_THREADSAFE"); |
| 434 | body.forLoop(iBegin, iEnd); |
| 435 | |
| 436 | #endif // #if BT_THREADSAFE |
| 437 | } |
| 438 | |
| 439 | btScalar btParallelSum(int iBegin, int iEnd, int grainSize, const btIParallelSumBody& body) |
| 440 | { |
no test coverage detected