distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
SemaphoreTryWaitForFunctor.hpp
Go to the documentation of this file.
1 
12 #ifndef INCLUDE_DISTORTOS_INTERNAL_SYNCHRONIZATION_SEMAPHORETRYWAITFORFUNCTOR_HPP_
13 #define INCLUDE_DISTORTOS_INTERNAL_SYNCHRONIZATION_SEMAPHORETRYWAITFORFUNCTOR_HPP_
14 
16 
17 #include "distortos/TickClock.hpp"
18 
19 namespace distortos
20 {
21 
22 namespace internal
23 {
24 
27 {
28 public:
29 
36  constexpr explicit SemaphoreTryWaitForFunctor(const TickClock::duration duration) :
37  duration_{duration}
38  {
39 
40  }
41 
50  int operator()(Semaphore& semaphore) const override;
51 
52 private:
53 
56 };
57 
58 } // namespace internal
59 
60 } // namespace distortos
61 
62 #endif // INCLUDE_DISTORTOS_INTERNAL_SYNCHRONIZATION_SEMAPHORETRYWAITFORFUNCTOR_HPP_
Semaphore is the basic synchronization primitive.
Definition: Semaphore.hpp:30
constexpr SemaphoreTryWaitForFunctor(const TickClock::duration duration)
SemaphoreTryWaitForFunctor's constructor.
Definition: SemaphoreTryWaitForFunctor.hpp:36
TickClock class header.
int operator()(Semaphore &semaphore) const override
Calls Semaphore::tryWaitFor() with bound duration.
Definition: SemaphoreTryWaitForFunctor.cpp:26
Top-level namespace of distortos project.
Definition: buttons.hpp:33
const TickClock::duration duration_
bound duration for Semaphore::tryWaitFor() call
Definition: SemaphoreTryWaitForFunctor.hpp:55
SemaphoreFunctor is a type-erased interface for functors which execute some action on semaphore (wait...
Definition: SemaphoreFunctor.hpp:34
std::chrono::duration< rep, period > duration
basic duration type of clock
Definition: TickClock.hpp:39
SemaphoreFunctor class header.
SemaphoreTryWaitForFunctor class is a SemaphoreFunctor which calls Semaphore::tryWaitFor() with bound...
Definition: SemaphoreTryWaitForFunctor.hpp:26