mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 07:14:10 +08:00
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:
committed by
Compute-Runtime-Automation
parent
c367c2b332
commit
253035878a
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user