APM:Libraries
Semaphores.cpp
Go to the documentation of this file.
1 
2 #include "Semaphores.h"
3 
4 using namespace Empty;
5 
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 
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 }
bool take_nonblocking()
Definition: Semaphores.cpp:19
bool take(uint32_t timeout_ms)
Definition: Semaphores.cpp:15