AP_HAL: New semaphore interface

* it now looks like a semaphore!
This commit is contained in:
Pat Hickey 2013-01-02 16:27:01 -08:00
parent acf05a29ee
commit 81d77d4a70

View File

@ -1,20 +1,18 @@
#ifndef __AP_HAL_SEMAPHORE_H__
#define __AP_HAL_SEMAPHORE_H__
#ifndef __AP_HAL_SEMAPHORES_H__
#define __AP_HAL_SEMAPHORES_H__
#include <AP_HAL_Namespace.h>
#include <limits.h>
#define HAL_SEMAPHORE_BLOCK_FOREVER UINT32_MAX
class AP_HAL::Semaphore {
public:
// get - to claim ownership of the semaphore
virtual bool get(void* caller) = 0;
// release - to give up ownership of the semaphore
virtual bool release(void* caller) = 0;
// call_on_release - returns true if caller successfully added to the
// queue to be called back
virtual bool call_on_release(void* caller, AP_HAL::Proc k) = 0;
virtual bool take(uint32_t timeout_ms) = 0;
virtual bool take_nonblocking() = 0;
virtual bool give() = 0;
};
#endif // __AP_HAL_SEMAPHORE_H__
#endif // __AP_HAL_SEMAPHORES_H__