Ensure sleep is called in direct submission controller

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2022-05-24 13:12:16 +00:00
committed by Compute-Runtime-Automation
parent 548f698722
commit d440d26c69
4 changed files with 20 additions and 6 deletions

View File

@@ -48,22 +48,19 @@ void *DirectSubmissionController::controlDirectSubmissionsState(void *self) {
auto controller = reinterpret_cast<DirectSubmissionController *>(self);
while (!controller->runControlling.load()) {
if (!controller->keepControlling.load()) {
return nullptr;
}
std::this_thread::sleep_for(std::chrono::microseconds(controller->timeout));
controller->sleep();
}
while (true) {
if (!controller->keepControlling.load()) {
return nullptr;
}
std::this_thread::sleep_for(std::chrono::microseconds(controller->timeout));
controller->sleep();
controller->checkNewSubmissions();
}
}
@@ -91,4 +88,8 @@ void DirectSubmissionController::checkNewSubmissions() {
}
}
void DirectSubmissionController::sleep() {
std::this_thread::sleep_for(std::chrono::microseconds(this->timeout));
}
} // namespace NEO

View File

@@ -37,6 +37,7 @@ class DirectSubmissionController {
static void *controlDirectSubmissionsState(void *self);
void checkNewSubmissions();
MOCKABLE_VIRTUAL void sleep();
std::unordered_map<CommandStreamReceiver *, DirectSubmissionState> directSubmissions;
std::mutex directSubmissionsMutex;