[Tinyos-devel] bug in ArbiterP.nc : Resource.release[uint8_t id]()

Aurélien Francillon aurelien.francillon at inrialpes.fr
Sat May 24 07:57:35 PDT 2008


Hi,
There is a problem with the default Arbiter, the  Resource.release 
command always returns FAIL status, while it should return FAIL only if 
the component isn't granted the resource and success if it was owner of 
the resource cf Resource.nc:

   * @return SUCCESS The resource has been released <br>
   *         FAIL You tried to release but you are not the
   *              owner of the resource

while the Arbiter.nc resource.release code can only return FAIL :

   async command error_t Resource.release[uint8_t id]() {
     atomic {
       if(state == RES_BUSY && resId == id) {
         if(call Queue.isEmpty() == FALSE) {
           reqResId = call Queue.dequeue();
           state = RES_GRANTING;
           post grantedTask();
           call ResourceConfigure.unconfigure[id]();
         }
         else {
           resId = default_owner_id;
           state = RES_CONTROLLED;
           call ResourceConfigure.unconfigure[id]();
           signal ResourceDefaultOwner.granted();
         }
	// BUG: should return SUCCESS here
       }
     }
     return FAIL;
   }

patch attached,

Cheers
Aurélien

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Arbiter_fix_release_return.patch
Type: text/x-patch
Size: 484 bytes
Desc: not available
Url : https://www.millennium.berkeley.edu/pipermail/tinyos-devel/attachments/20080524/f5ff46da/attachment.bin 


More information about the Tinyos-devel mailing list