Arduino-Scheduler
Portable Collaborative Multi-Tasking Scheduler for Arduino
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
Semaphore.h
Go to the documentation of this file.
1
19
#ifndef SCHEDULER_SEMAPHORE_H
20
#define SCHEDULER_SEMAPHORE_H
21
22
#include <
Scheduler.h
>
23
24
class
Semaphore
{
25
public
:
30
Semaphore
(
unsigned
int
count
= 1) :
m_count
(
count
) {}
31
36
void
wait
(
unsigned
int
count
= 1)
37
{
38
await
(
m_count
>=
count
);
39
m_count
-=
count
;
40
}
41
46
void
signal
(
unsigned
int
count
= 1)
47
{
48
m_count
+=
count
;
49
Scheduler
.
yield
();
50
}
51
52
protected
:
53
volatile
unsigned
int
m_count
;
54
};
55
56
#endif
Semaphore::wait
void wait(unsigned int count=1)
Definition:
Semaphore.h:36
Semaphore
Definition:
Semaphore.h:24
await
#define await(cond)
Definition:
Scheduler.h:162
Semaphore::m_count
volatile unsigned int m_count
Definition:
Semaphore.h:53
Semaphore::Semaphore
Semaphore(unsigned int count=1)
Definition:
Semaphore.h:30
count
unsigned long count
Definition:
SchedulerBenchmarkChannel.ino:43
SchedulerClass::yield
static void yield()
Definition:
Scheduler.cpp:117
Scheduler
SchedulerClass Scheduler
Definition:
Scheduler.cpp:53
Semaphore::signal
void signal(unsigned int count=1)
Definition:
Semaphore.h:46
Scheduler.h
src
Scheduler
Semaphore.h
Generated on Thu Aug 31 2017 12:52:30 for Arduino-Scheduler by
1.8.11