[Tinyos-devel] Problem with ArbiterP - ResourceDefaultOwner.isOwner()

Ken Bannister regkb at deru.com
Thu Nov 1 20:16:52 PDT 2007


I have found an incompatibility with the latest change to ArbiterP's 
implementation of ResourceDefaultOwner.isOwner(). The issue occurs when 
trying to use a Sensirion Sht11 sensor with the SensirionSht11C component.

The problem is a consequence of the wiring in HplSensirionSht11C. It 
allocates an FcfsArbiterC and wires 
SplitControlPowerManagerC.ResourceDefaultOwner to the Arbiter.

When the higher level SensirionSht11C handles a read request it first 
requests the resource, which puts ArbiterP in RES_GRANTING state and then 
the ResourceDefaultOwner.requested() event is triggered. PowerManagerP's 
response eventually executes:

   event void SplitControl.startDone(error_t error) {
     if(call ResourceDefaultOwner.isOwner())
       call ResourceDefaultOwner.release();
   }

At this point isOwner() returns false since it's no longer in RES_CONTROLLED 
state. I have worked around the problem by modifying the implementation of 
isOwner() to:

     atomic
     return state == RES_CONTROLLED
             || (resId == default_owner_id
                 && (state == RES_GRANTING || state == RES_IMM_GRANTING));


There seems to be several scenarios when isOwner() is called, and I don't 
have the experience to suggest a more comprehensive solution.


More information about the Tinyos-devel mailing list