Revert "test: lower priority of alarm thread in Windows ULT"

This reverts commit 95eb723ca5.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2023-12-07 04:53:39 +01:00
committed by Compute-Runtime-Automation
parent c367c2b332
commit 253035878a

View File

@@ -73,7 +73,7 @@ int setAlarm(bool enableAlarm) {
if (enableAlarm) {
abortOnTimeout = true;
std::atomic<bool> threadStarted{false};
std::condition_variable threadStarted;
alarmThread = std::make_unique<std::thread>([&]() {
auto currentUltIterationMaxTime = NEO::ultIterationMaxTime;
auto ultIterationMaxTimeEnv = getenv("NEO_ULT_ITERATION_MAX_TIME");
@@ -82,13 +82,12 @@ int setAlarm(bool enableAlarm) {
}
unsigned int alarmTime = currentUltIterationMaxTime * ::testing::GTEST_FLAG(repeat);
std::cout << "set timeout to: " << alarmTime << std::endl;
threadStarted = true;
threadStarted.notify_all();
std::chrono::high_resolution_clock::time_point startTime, endTime;
std::chrono::milliseconds elapsedTime{};
startTime = std::chrono::high_resolution_clock::now();
do {
std::this_thread::yield();
std::this_thread::sleep_for(std::chrono::milliseconds(1));
endTime = std::chrono::high_resolution_clock::now();
elapsedTime = std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime);
if (!abortOnTimeout) {
@@ -102,11 +101,10 @@ int setAlarm(bool enableAlarm) {
abort();
}
});
SetThreadPriority(alarmThread->native_handle(), THREAD_PRIORITY_LOWEST);
while (!threadStarted.load()) {
std::this_thread::yield();
}
std::mutex mtx;
std::unique_lock<std::mutex> lock(mtx);
threadStarted.wait(lock);
}
return 0;