cvedia::rt::AsyncInferenceWorker¶
Protected Classes¶
Name | |
---|---|
struct | AsyncJob_ |
struct | AsyncResult_ |
struct | WeakPtrComparator_ |
Public Types¶
Name | |
---|---|
using std::function< expected< cvec >(cvec const &)> | runInferenceFunc |
Public Functions¶
Name | |
---|---|
AsyncInferenceWorker() =default | |
~AsyncInferenceWorker() | |
NODISCARD expected< void > | initialize(runInferenceFunc runInference) |
NODISCARD expected< void > | submitJobs(cvec const & jobs, int ttl) |
NODISCARD expected< cvec > | getResults() |
NODISCARD expected< void > | setResultsCollectionDuration(int durationMs) |
void | stop() |
Protected Functions¶
Name | |
---|---|
NODISCARD expected< void > | _isInitialized() |
NODISCARD expected< void > | _asyncWorker() |
NODISCARD expected< void > | _asyncGarbageCollector() |
Protected Attributes¶
Name | |
---|---|
std::atomic< bool > | isInitialized_ |
runInferenceFunc | runInference_ |
std::thread | asyncThread_ |
std::thread | asyncGarbageCollectorThread_ |
std::condition_variable | asyncCondition_ |
std::mutex | asyncJobsMutex_ |
std::mutex | asyncResultsMutex_ |
bool | asyncStopFlag_ |
int | asyncGarbageCollectionDurationMs_ |
std::size_t | jobQueueSize_ |
bool | stopCalled_ |
std::queue< AsyncJob_ > | asyncJobQueue_ |
std::map< std::weak_ptr< iface::Instance >, std::queue< AsyncResult_ >, WeakPtrComparator_ > | asyncResultQueue_ |
Public Types Documentation¶
using runInferenceFunc¶
using runInferenceFunc = std::function<expected<cvec>(cvec const&)>;
Public Functions Documentation¶
function AsyncInferenceWorker¶
AsyncInferenceWorker() =default
function ~AsyncInferenceWorker¶
~AsyncInferenceWorker()
function initialize¶
NODISCARD expected< void > initialize(
runInferenceFunc runInference
)
function submitJobs¶
NODISCARD expected< void > submitJobs(
cvec const & jobs,
int ttl
)
function getResults¶
NODISCARD expected< cvec > getResults()
function setResultsCollectionDuration¶
NODISCARD expected< void > setResultsCollectionDuration(
int durationMs
)
function stop¶
void stop()
Protected Functions Documentation¶
function _isInitialized¶
NODISCARD expected< void > _isInitialized()
function _asyncWorker¶
NODISCARD expected< void > _asyncWorker()
function _asyncGarbageCollector¶
NODISCARD expected< void > _asyncGarbageCollector()
Protected Attributes Documentation¶
variable isInitialized_¶
std::atomic< bool > isInitialized_ = false;
variable runInference_¶
runInferenceFunc runInference_;
variable asyncThread_¶
std::thread asyncThread_;
variable asyncGarbageCollectorThread_¶
std::thread asyncGarbageCollectorThread_;
variable asyncCondition_¶
std::condition_variable asyncCondition_;
variable asyncJobsMutex_¶
std::mutex asyncJobsMutex_;
variable asyncResultsMutex_¶
std::mutex asyncResultsMutex_;
variable asyncStopFlag_¶
bool asyncStopFlag_ = false;
variable asyncGarbageCollectionDurationMs_¶
int asyncGarbageCollectionDurationMs_ = 100;
variable jobQueueSize_¶
std::size_t jobQueueSize_ = 30;
variable stopCalled_¶
bool stopCalled_ = false;
variable asyncJobQueue_¶
std::queue< AsyncJob_ > asyncJobQueue_;
variable asyncResultQueue_¶
std::map< std::weak_ptr< iface::Instance >, std::queue< AsyncResult_ >, WeakPtrComparator_ > asyncResultQueue_;
Updated on 2025-08-24 at 15:42:37 +0000