Add CAN-driven lazy inference with resident TensorRT engines
This commit is contained in:
@@ -18,6 +18,15 @@ public:
|
||||
if(closed_)return false;
|
||||
items_.push_back(std::move(item));changed_.notify_all();return true;
|
||||
}
|
||||
bool pushLatest(T item) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
if(closed_)return false;
|
||||
if(items_.size()==capacity_)items_.pop_front();
|
||||
items_.push_back(std::move(item));changed_.notify_all();return true;
|
||||
}
|
||||
void clear() {
|
||||
std::lock_guard<std::mutex> lock(mutex_);items_.clear();changed_.notify_all();
|
||||
}
|
||||
std::optional<T> pop() {
|
||||
std::unique_lock<std::mutex> lock(mutex_);
|
||||
changed_.wait(lock,[&]{return closed_||!items_.empty();});
|
||||
|
||||
Reference in New Issue
Block a user