ADTF  3.18.2
kernel_timeout.h
Go to the documentation of this file.
1 
7 #include "kernel_timer.h"
8 
9 namespace adtf
10 {
11 
12 namespace system
13 {
14 
19 {
20  private:
21  kernel_timer m_oTimer;
22 
23  public:
27  template <typename Callable, typename ...Args>
28  tResult Start(const char* strName,
29  std::chrono::microseconds tmTimeout,
30  Callable&& oMethod, Args&&... args)
31  {
33 
34  m_oTimer = kernel_timer(strName, 0, tmTimeout.count(), oMethod, std::forward<Args>(args)...);
35  if (!m_oTimer.Stoppable())
36  {
37  RETURN_ERROR(ERR_UNEXPECTED);
38  }
39 
41  }
42 
48 };
49 
50 }
51 
52 }
#define RETURN_IF_FAILED(s)
Return if expression is failed, which requires the calling function's return type to be tResult.
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
#define RETURN_ERROR(code)
Return specific error code, which requires the calling function's return type to be tResult.
Calls the given method if a timeout occures.
tResult Cancel()
Cancels the timeout.
tResult Start(const char *strName, std::chrono::microseconds tmTimeout, Callable &&oMethod, Args &&... args)
(Re-)Starts the timeout.
Class that wraps a kernel timer to call a method at specified intervals.
Definition: kernel_timer.h:20
bool Stoppable() const
Whether or not the timer is stoppable, i.e.
Copyright © Audi Electronics Venture GmbH.
Namespace for entire ADTF SDK.