ArmNN
 22.11
AsyncCallbackManager Class Reference

#include <AsyncExecutionCallback.hpp>

Public Member Functions

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

Detailed Description

Definition at line 76 of file AsyncExecutionCallback.hpp.

Member Function Documentation

◆ GetNewCallback()

std::shared_ptr< AsyncExecutionCallback > GetNewCallback ( )

Definition at line 46 of file AsyncExecutionCallback.cpp.

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

◆ GetNotifiedCallback()

std::shared_ptr< AsyncExecutionCallback > GetNotifiedCallback ( )

Definition at line 60 of file AsyncExecutionCallback.cpp.

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

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