X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=blobdiff_plain;f=tos%2Fsystem%2FSharedArbiterP.nc;h=1228c2a19c4f314441e4d77039eb13da49e4d60f;hp=c3503131cde02a93edb6d775de6a5b9d807ad0d6;hb=517a91449b03531a02547ae840346474e7891f45;hpb=d8f0e6966930184e8b584a6c9d39849a2f47986c diff --git a/tos/system/SharedArbiterP.nc b/tos/system/SharedArbiterP.nc index c3503131..1228c2a1 100644 --- a/tos/system/SharedArbiterP.nc +++ b/tos/system/SharedArbiterP.nc @@ -128,8 +128,12 @@ implementation { 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()) @@ -141,8 +145,12 @@ implementation { 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();