mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-02 14:13:42 -04:00
2ffb08b9ca
Like was done for AP_HAL_Linux in 2ac96b9
("AP_HAL_Linux: remove prefix
from AP_HAL_Linux classes"), remove the "Empty" prefix from class names
since we are already inside the Empty namespace.
28 lines
470 B
C++
28 lines
470 B
C++
|
|
#include "Semaphores.h"
|
|
|
|
using namespace Empty;
|
|
|
|
bool Semaphore::give() {
|
|
if (_taken) {
|
|
_taken = false;
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
bool Semaphore::take(uint32_t timeout_ms) {
|
|
return take_nonblocking();
|
|
}
|
|
|
|
bool Semaphore::take_nonblocking() {
|
|
/* No syncronisation primitives to garuntee this is correct */
|
|
if (!_taken) {
|
|
_taken = true;
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|