APM:Libraries
Semaphores.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <pthread.h>
4 
5 #include <AP_HAL/AP_HAL_Boards.h>
6 
7 #include "AP_HAL_Linux.h"
8 
9 namespace Linux {
10 
11 class Semaphore : public AP_HAL::Semaphore {
12 public:
14  pthread_mutex_init(&_lock, nullptr);
15  }
16  bool give();
17  bool take(uint32_t timeout_ms);
18  bool take_nonblocking();
19 private:
20  pthread_mutex_t _lock;
21 };
22 
23 }
bool take(uint32_t timeout_ms)
Definition: Semaphores.cpp:14
bool take_nonblocking()
Definition: Semaphores.cpp:32
pthread_mutex_t _lock
Definition: Semaphores.h:20