mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 06:24:51 +08:00
Related-To: NEO-12197 Currently for new resources user thread must wait before submitting actual workload. With this commit, instead of waiting on user thread, request is sent to background ULLS controller thread and additional semaphore is programmed. ULLS controller will perform actual wait and signal semaphore when paging fence reaches required value. Signed-off-by: Szymon Morek <szymon.morek@intel.com>
24 lines
621 B
C++
24 lines
621 B
C++
/*
|
|
* Copyright (C) 2022-2024 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
#include <condition_variable>
|
|
#include <thread>
|
|
|
|
namespace NEO {
|
|
template <class T>
|
|
void sleep(const T &sleepDuration);
|
|
|
|
template <class T>
|
|
void waitOnCondition(std::condition_variable &condition, std::unique_lock<std::mutex> &lock, const T &duration);
|
|
|
|
template <class T, class Predicate>
|
|
bool waitOnConditionWithPredicate(std::condition_variable &condition, std::unique_lock<std::mutex> &lock, const T &duration, Predicate predicate) {
|
|
return condition.wait_for(lock, duration, predicate);
|
|
}
|
|
} // namespace NEO
|