Beispiel #1
0
__dllexport bool LockStepTaskScheduler::dispatchTask(const size_t threadID, size_t numThreads)
{
    if (threadID == 0) {
        taskCounter.reset(0);
    }

    syncThreads(threadID, numThreads);

    if (taskPtr) {
        (*taskPtr)((void*)data,threadID,numThreads);
        syncThreads(threadID, numThreads);
        return false;
    }

    if (taskPtr2) {
        while (true) {
            size_t taskID = taskCounter.inc();
            if (taskID >= numTasks) break;
            (*taskPtr2)((void*)data,threadID,numThreads,taskID,numTasks);
        }
        syncThreads(threadID, numThreads);
        return false;
    }
    return true;
}
Beispiel #2
0
bool LockStepTaskScheduler4ThreadsLocalCore::dispatchTask(const size_t localThreadID, const size_t globalThreadID)
{
    syncThreads(localThreadID);

    if (taskPtr == nullptr)
        return true;

    (*taskPtr)((void*)data,localThreadID,globalThreadID);
    syncThreads(localThreadID);

    return false;
}
Beispiel #3
0
  bool LockStepTaskScheduler::dispatchTask(const size_t threadID, const size_t numThreads)
  {
    if (threadID == 0)
      taskCounter.reset(0);

    syncThreads(threadID, numThreads);

    if (taskPtr == NULL) 
      return true;

    (*taskPtr)((void*)data,threadID,numThreads);
    syncThreads(threadID, numThreads);
    
    return false;
  }
Beispiel #4
0
void AtlasFile::precache()
{
   U32 pendingCount = 1;
   while(pendingCount)
   {
      syncThreads();

      Platform::sleep(32);
 
      // Check for pending data; if there is some just skip to a synch.
      pendingCount = mPendingDeserializeQueue.lockVector().size();
      mPendingDeserializeQueue.unlockVector();

      if(pendingCount)
         continue;

      pendingCount = mPendingLoadQueue.lockVector().size();
      mPendingLoadQueue.unlockVector();

      if(pendingCount)
         continue;

      pendingCount = mPendingProcessQueue.lockVector().size();
      mPendingProcessQueue.unlockVector();
   }
}