performance/Tutorial_MultiThreading.cpp
#include "common/oneworldenv.h"
#include "labengine/threading/workerthread.h"
namespace
{
#define KT_TEST_ENV_CLASS OneWorldEnv
KT_TEST_ENV {}
KT_TUTORIAL
{
KT_LOG_TITLE_BEGIN("TUTORIAL - How to perform a single time-sliced query using the default queue of the world with processing on a worker thread.");
KT_ASSERT(KT_ENV.AddNavData("generated/canyon/canyon.NavData") != nullptr);
LabEngine::ScopedUseWorkerThread workerThread(KT_ENV.GetGameWorld());
navWorld->PushAsyncQuery(query, Kaim::AsyncQueryDispatchId_PathFinder);
while (query->IsSafeToReadResult() == false)
{
navWorld->Update();
}
KT_ASSERT(query->IsSafeToReadResult() == true);
}
}