MCPcopy Create free account
hub / github.com/comaps/comaps / GetTransitDisplayInfo

Method GetTransitDisplayInfo

libs/map/transit/transit_reader.cpp:454–492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

452}
453
454bool TransitReadManager::GetTransitDisplayInfo(TransitDisplayInfos & transitDisplayInfos)
455{
456 unique_lock<mutex> lock(m_mutex);
457 auto const groupId = ++m_nextTasksGroupId;
458 lock.unlock();
459
460 map<MwmSet::MwmId, unique_ptr<ReadTransitTask>> transitTasks;
461 for (auto & mwmTransitPair : transitDisplayInfos)
462 {
463 auto const & mwmId = mwmTransitPair.first;
464 auto task = make_unique<ReadTransitTask>(m_dataSource, m_readFeaturesFn);
465 task->Init(groupId, mwmId, std::move(mwmTransitPair.second));
466 transitTasks[mwmId] = std::move(task);
467 }
468
469 lock.lock();
470 m_tasksGroups[groupId] = transitTasks.size();
471 lock.unlock();
472
473 for (auto const & task : transitTasks)
474 m_threadsPool->PushBack(task.second.get());
475
476 lock.lock();
477 m_event.wait(lock, [&]() { return m_tasksGroups[groupId] == 0; });
478 m_tasksGroups.erase(groupId);
479 lock.unlock();
480
481 bool result = true;
482 for (auto const & transitTask : transitTasks)
483 {
484 if (!transitTask.second->GetSuccess())
485 {
486 result = false;
487 continue;
488 }
489 transitDisplayInfos[transitTask.first] = transitTask.second->GetTransitInfo();
490 }
491 return result;
492}
493
494void TransitReadManager::OnTaskCompleted(threads::IRoutine * task)
495{

Callers 1

ProcessSubrouteMethod · 0.80

Calls 10

unlockMethod · 0.80
lockMethod · 0.80
waitMethod · 0.80
GetSuccessMethod · 0.80
getMethod · 0.65
InitMethod · 0.45
sizeMethod · 0.45
PushBackMethod · 0.45
eraseMethod · 0.45
GetTransitInfoMethod · 0.45

Tested by

no test coverage detected