[Tinyos-devel] Resource.isOwner() can return false information
Roman Lim
rlim at ee.ethz.ch
Fri Aug 24 01:11:20 PDT 2007
example case:
client0 requests resource
client1 requests resource
client0 gets the resource granted
client0 has a loop wherein it:
*releases the resource on a certain condition
*exits the loop, if the resource was released (e.g. isOwner() returns
false)
in this case, isOwner() will always return 'true' because in the current
implementation, 'resId' is changed in a task that will run after the
loop of client0 is finished:
in the case of SimpleArbiter, 'resId' is only set to NO_RES, if no
request is pending upon release. In the other case, 'resId' remains
client0, until the granted task gets executed (after that, it changes to
client1).
in the case of normal Arbiters 'resId' is also only set to the default
owner's id, if no request is pending at the time when the resource was
released.
by my understanding, isOwner() should return false after the command
release() has been called.
roman
Kevin Klues wrote:
> Can you give a use case where this actually occurs? I understand your
> concern... as well as your proposed solution,but as it is implemented
> now, upon release 'resId' is either set to NO_RES in the case of
> SimpleArbiters or the resource is handed over to its default owner in
> the case of normal Arbiters. I'm not sure under what circumstances it
> would falsely return TRUE.
>
> Kevin
>
> On 8/23/07, Roman Lim <rlim at ee.ethz.ch> wrote:
>> Hi
>> I just had a case, where I found a call to Resource.isOwner() returning
>> TRUE, even when the Resource was just released.
>>
>> If there is a request pending while releasing the resource, resId does
>> not get assigned another id immediately, but only when the granted task
>> gets executed. A call to Resource.isOwner() between release and granted
>> will therefore return true for the component that just released the
>> resource, because isOwner just compares the id of the caller and the
>> resId to determine the return value.
>>
>> I suggest to check the state of the arbiter in the isOwner() command,
>> too and return true, if id==resId and state==RES_BUSY.
>>
>> Roman
>> _______________________________________________
>> Tinyos-devel mailing list
>> Tinyos-devel at Millennium.Berkeley.EDU
>> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-devel
>>
>
>
More information about the Tinyos-devel
mailing list