Semaphores.h 526 B

1234567891011121314151617181920212223242526
  1. #pragma once
  2. #include <AP_HAL/AP_HAL_Boards.h>
  3. #include <stdint.h>
  4. #include <AP_HAL/AP_HAL_Macros.h>
  5. #include <AP_HAL/Semaphores.h>
  6. #include "AP_HAL_SITL_Namespace.h"
  7. #include <pthread.h>
  8. class HALSITL::Semaphore : public AP_HAL::Semaphore {
  9. public:
  10. Semaphore();
  11. bool give() override;
  12. bool take(uint32_t timeout_ms) override;
  13. bool take_nonblocking() override;
  14. protected:
  15. pthread_mutex_t _lock;
  16. };
  17. class HALSITL::Semaphore_Recursive : public HALSITL::Semaphore {
  18. public:
  19. Semaphore_Recursive();
  20. };