Lines Matching defs:thread
93 CPUEUTask* CPUWorkerManager::PickUpTaskFromLocalQueue(WorkerThread* thread)
99 CPUWorker* worker = reinterpret_cast<CPUWorker*>(thread);
104 unsigned int CPUWorkerManager::StealTaskBatch(WorkerThread* thread)
110 if (GetStealingWorkers(thread->GetQos()) > groupCtl[thread->GetQos()].threads.size() / 2) {
114 std::shared_lock<std::shared_mutex> lck(groupCtl[thread->GetQos()].tgMutex);
115 AddStealingWorker(thread->GetQos());
117 groupCtl[thread->GetQos()].threads.begin();
118 while (iter != groupCtl[thread->GetQos()].threads.end()) {
121 if (iter->first != thread && queueLen > 0) {
123 reinterpret_cast<CPUWorker*>(thread)->localFifo, (queueLen + 1) / 2, thread->GetQos(), InsertTask);
124 SubStealingWorker(thread->GetQos());
129 SubStealingWorker(thread->GetQos());
133 PollerRet CPUWorkerManager::TryPoll(const WorkerThread* thread, int timeout)
135 if (tearDown || FFRTFacade::GetPPInstance().GetPoller(thread->GetQos()).DetermineEmptyMap()) {
138 auto& pollerMtx = pollersMtx[thread->GetQos()];
140 polling_[thread->GetQos()] = 1;
142 monitor->IntoPollWait(thread->GetQos());
144 PollerRet ret = FFRTFacade::GetPPInstance().GetPoller(thread->GetQos()).PollOnce(timeout);
146 monitor->OutOfPollWait(thread->GetQos());
148 polling_[thread->GetQos()] = 0;
162 void CPUWorkerManager::NotifyTaskPicked(const WorkerThread* thread)
164 monitor->Notify(thread->GetQos(), TaskNotifyType::TASK_PICKED);
167 void CPUWorkerManager::WorkerRetired(WorkerThread* thread)
169 pid_t pid = thread->Id();
170 int qos = static_cast<int>(thread->GetQos());
174 thread->SetExited(true);
175 thread->Detach();
176 auto worker = std::move(groupCtl[qos].threads[thread]);
177 int ret = groupCtl[qos].threads.erase(thread);
179 FFRT_LOGE("erase qos[%d] thread failed, %d elements removed", qos, ret);
247 bool CPUWorkerManager::IsExceedRunningThreshold(const WorkerThread* thread)
249 return monitor->IsExceedRunningThreshold(thread->GetQos());