Ardupilot2/libraries/AP_HAL_AVR/Semaphores.h
Andrew Tridgell a3c26d44e4 AP_HAL: rename Sempahore.h to Semaphores.h
this is needed to allow build on MacOS, as its case-insensitive
filesystem picks up the NuttX semaphore.h
2013-01-02 18:22:13 +11:00

33 lines
776 B
C++

#ifndef __AP_HAL_AVR_SEMAPHORE_H__
#define __AP_HAL_AVR_SEMAPHORE_H__
#include <AP_HAL.h>
#include <AP_HAL_AVR_Namespace.h>
class AP_HAL_AVR::AVRSemaphore : public AP_HAL::Semaphore {
public:
// Constructor
AVRSemaphore();
// get - to claim ownership of the semaphore
bool get(void* caller);
// release - to give up ownership of the semaphore
bool release(void* caller);
// call_on_release - returns true if caller successfully added to the
// queue to be called back
bool call_on_release(void* caller, AP_HAL::Proc k);
protected:
bool _taken;
void* _owner;
void* _waiting_owner;
// procedure of process waiting for sempahore
AP_HAL::Proc _waiting_k;
};
#endif // __AP_HAL_AVR_SEMAPHORE_H__