]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Conform SharedArbiterP better to TEP108.
authorR. Steve McKown <rsmckown@gmail.com>
Wed, 15 Sep 2010 18:44:11 +0000 (12:44 -0600)
committerR. Steve McKown <rsmckown@gmail.com>
Fri, 17 Sep 2010 01:40:47 +0000 (19:40 -0600)
tos/system/SharedArbiterP.nc

index c3503131cde02a93edb6d775de6a5b9d807ad0d6..1228c2a19c4f314441e4d77039eb13da49e4d60f 100644 (file)
@@ -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();