AP_HAL: New semaphore interface
* it now looks like a semaphore!
This commit is contained in:
parent
acf05a29ee
commit
81d77d4a70
@ -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__
|
||||
|
Loading…
Reference in New Issue
Block a user