ArmNN
 24.02
AsyncCallbackManager Class Reference

#include <AsyncExecutionCallback.hpp>

Public Member Functions

std::shared_ptr< AsyncExecutionCallbackGetNewCallback ()
 
std::shared_ptr< AsyncExecutionCallbackGetNotifiedCallback ()
 

Detailed Description

Definition at line 75 of file AsyncExecutionCallback.hpp.

Member Function Documentation

◆ GetNewCallback()

std::shared_ptr< AsyncExecutionCallback > GetNewCallback ( )

Definition at line 48 of file AsyncExecutionCallback.cpp.

49 {
50  auto cb = std::make_unique<AsyncExecutionCallback>(m_NotificationQueue
51 #if !defined(ARMNN_DISABLE_THREADS)
52  , m_Mutex
53  , m_Condition
54 #endif
55  );
56  InferenceId id = cb->GetInferenceId();
57  m_Callbacks.insert({id, std::move(cb)});
58 
59  return m_Callbacks.at(id);
60 }

◆ GetNotifiedCallback()

std::shared_ptr< AsyncExecutionCallback > GetNotifiedCallback ( )

Definition at line 62 of file AsyncExecutionCallback.cpp.

63 {
64 #if !defined(ARMNN_DISABLE_THREADS)
65  std::unique_lock<std::mutex> lock(m_Mutex);
66 
67  m_Condition.wait(lock, [this] { return !m_NotificationQueue.empty(); });
68 #endif
69  InferenceId id = m_NotificationQueue.front();
70  m_NotificationQueue.pop();
71 
72  std::shared_ptr<AsyncExecutionCallback> callback = m_Callbacks.at(id);
73  m_Callbacks.erase(id);
74  return callback;
75 }

The documentation for this class was generated from the following files:
armnn::experimental::InferenceId
uint64_t InferenceId
Definition: AsyncExecutionCallback.hpp:24