COSA
An Object-Oriented Platform for Arduino Programming
Semaphore.hh
Go to the documentation of this file.
1 
21 #ifndef COSA_NUCLEO_SEMAPHORE_HH
22 #define COSA_NUCLEO_SEMAPHORE_HH
23 
24 #include "Cosa/Types.h"
25 #include "Cosa/Linkage.hh"
26 
27 namespace Nucleo {
28 
32 class Semaphore {
33 public:
38  Semaphore(uint8_t count = 1) : m_queue(), m_count(count) {}
39 
45  void wait(uint8_t count = 1);
46 
53  void signal(uint8_t count = 1, bool flag = true);
54 
55 private:
57  Head m_queue;
58 
60  volatile uint8_t m_count;
61 };
62 
63 };
64 #endif
Definition: Actor.hh:26
void wait(uint8_t count=1)
Definition: Semaphore.cpp:27
void signal(uint8_t count=1, bool flag=true)
Definition: Semaphore.cpp:40
Semaphore(uint8_t count=1)
Definition: Semaphore.hh:38
Definition: Linkage.hh:132