ArmNN
 21.11
AsyncCallbackManager Class Reference

#include <AsyncExecutionCallback.hpp>

Public Member Functions

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

Detailed Description

Definition at line 69 of file AsyncExecutionCallback.hpp.

Member Function Documentation

◆ GetNewCallback()

std::shared_ptr< AsyncExecutionCallback > GetNewCallback ( )

Definition at line 42 of file AsyncExecutionCallback.cpp.

Referenced by MainImpl().

43 {
44  auto cb = std::make_unique<AsyncExecutionCallback>(m_NotificationQueue, m_Mutex, m_Condition);
45  InferenceId id = cb->GetInferenceId();
46  m_Callbacks.insert({id, std::move(cb)});
47 
48  return m_Callbacks.at(id);
49 }

◆ GetNotifiedCallback()

std::shared_ptr< AsyncExecutionCallback > GetNotifiedCallback ( )

Definition at line 51 of file AsyncExecutionCallback.cpp.

Referenced by armnn::experimental::AsyncEndToEndTestImpl(), and MainImpl().

52 {
53  std::unique_lock<std::mutex> lock(m_Mutex);
54 
55  m_Condition.wait(lock, [this] { return !m_NotificationQueue.empty(); });
56 
57  InferenceId id = m_NotificationQueue.front();
58  m_NotificationQueue.pop();
59 
60  std::shared_ptr<AsyncExecutionCallback> callback = m_Callbacks.at(id);
61  m_Callbacks.erase(id);
62  return callback;
63 }

The documentation for this class was generated from the following files: