async command error_t Resource.request[uint8_t id]()
{
+ /* The Resource docs do not say what happens when a user calls
+ * Resource.request() after the resource has already been granted. We
+ * elect to call EBUSY, as if the request was still in process.
+ */
if (call RequestingVector.get(id) || call GrantedVector.get(id))
- return FAIL;
+ return EBUSY;
addRequesting(id);
if (call State.isIdle())
async command error_t Resource.immediateRequest[uint8_t id]()
{
+ /* The Resource docs do not say what happens when a user calls
+ * Resource.request() after the resource has already been granted. We
+ * elect to call EBUSY, as if the request was still in process.
+ */
if (call RequestingVector.get(id) || call GrantedVector.get(id))
- return FAIL;
+ return EBUSY;
if (call State.isIdle())
signal ResourceDefaultOwner.immediateRequested();