]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/system/SimpleArbiterP.nc
Fixed bug that allowed isOwner() to return false ownership between pending requests...
[tinyos-2.x.git] / tos / system / SimpleArbiterP.nc
index c5e82f290b1be35491db3e63e11f6e671e0d4a14..91d883a0bce74daf3b097ebe5d4437be276496be 100644 (file)
@@ -134,7 +134,11 @@ implementation {
     will be 0xFF
   */      
   async command uint8_t ArbiterInfo.userId() {
-    atomic return resId;
+    atomic {
+      if(state != RES_BUSY)
+        return NO_RES;
+      return resId;
+    }
   }
 
   /**
@@ -142,7 +146,7 @@ implementation {
    */      
   async command uint8_t Resource.isOwner[uint8_t id]() {
     atomic {
-      if(resId == id) return TRUE;
+      if(resId == id && state == RES_BUSY) return TRUE;
       else return FALSE;
     }
   }