APM:Libraries
libraries
AP_HAL_Empty
Semaphores.cpp
Go to the documentation of this file.
1
2
#include "
Semaphores.h
"
3
4
using namespace
Empty
;
5
6
bool
Semaphore::give
() {
7
if
(
_taken
) {
8
_taken
=
false
;
9
return
true
;
10
}
else
{
11
return
false
;
12
}
13
}
14
15
bool
Semaphore::take
(uint32_t timeout_ms) {
16
return
take_nonblocking
();
17
}
18
19
bool
Semaphore::take_nonblocking
() {
20
/* No syncronisation primitives to garuntee this is correct */
21
if
(!
_taken
) {
22
_taken
=
true
;
23
return
true
;
24
}
else
{
25
return
false
;
26
}
27
}
Empty
Definition:
AP_HAL_Empty_Namespace.h:3
Semaphores.h
Empty::Semaphore::take_nonblocking
bool take_nonblocking()
Definition:
Semaphores.cpp:19
Empty::Semaphore::take
bool take(uint32_t timeout_ms)
Definition:
Semaphores.cpp:15
Empty::Semaphore::give
bool give()
Definition:
Semaphores.cpp:6
Empty::Semaphore::_taken
bool _taken
Definition:
Semaphores.h:12
Generated on Sun Jun 17 2018 14:18:48 for APM:Libraries by
1.8.13