tinyos/tinyos-main — pull request #255 by mcerveny (2014-02-25 19:25:45+00:00)
Title: Implements more EBUSY on Resource.request() (TEP108)

There is problem with multiple calls to SimpleArbiterP.nc Resource.request().

Problem description - call 3x Resource.request() in one task:
1) resource is free (state == RES_IDLE )
2) 1. call Resource.request() returns __SUCCESS__ (state == RES_GRANTING) and post is planned
3) 2. call Resource.request() returns __SUCCESS__ !!! (state == RES_GRANTING) and id is queued (Queue.enqueue(id))
4) 3. call Resource.request() returns __EBUSY__ (state == RES_GRANTING) and id is already queued (see ResourceQueue).

TEP108: 3.1 "... If a client ever makes multiple requests before receiving a granted event, an EBUSY value is returned, and the request is not queued. ..."

I suppose that correct return code for 3) is __EBUSY__ too and __NOT__ queue request.
I have problem with that, Resource.granted is called 2 times and if I do everything with first call,
there is no work for the second call.

There are similar problems with ArbiterP.nc (that return __SUCCESS__ instead __EBUSY__), FcfsPriorityArbiterC.nc.