[Tinyos-2-commits] CVS: tinyos-2.x/tos/system ArbiterP.nc, 1.5,
1.6 SimpleArbiterP.nc, 1.3, 1.4
Kevin Klues
klueska at users.sourceforge.net
Fri Aug 24 09:10:15 PDT 2007
Update of /cvsroot/tinyos/tinyos-2.x/tos/system
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv32502/tos/system
Modified Files:
ArbiterP.nc SimpleArbiterP.nc
Log Message:
Fixed bug that allowed isOwner() to return false ownership between pending requests being granted.
Index: ArbiterP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/system/ArbiterP.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ArbiterP.nc 15 Apr 2007 20:33:34 -0000 1.5
--- ArbiterP.nc 24 Aug 2007 16:10:09 -0000 1.6
***************
*** 67,70 ****
--- 67,71 ----
enum {RES_CONTROLLED, RES_GRANTING, RES_IMM_GRANTING, RES_BUSY};
enum {default_owner_id = default_owner_id};
+ enum {NO_RES = 0xFF};
uint8_t state = RES_CONTROLLED;
***************
*** 145,148 ****
--- 146,153 ----
*/
async command bool ArbiterInfo.inUse() {
+ atomic {
+ if (state == RES_CONTROLLED)
+ return FALSE;
+ }
return TRUE;
}
***************
*** 154,158 ****
*/
async command uint8_t ArbiterInfo.userId() {
! atomic return resId;
}
--- 159,167 ----
*/
async command uint8_t ArbiterInfo.userId() {
! atomic {
! if(state != RES_BUSY)
! return NO_RES;
! return resId;
! }
}
***************
*** 162,166 ****
async command uint8_t Resource.isOwner[uint8_t id]() {
atomic {
! if(resId == id) return TRUE;
else return FALSE;
}
--- 171,175 ----
async command uint8_t Resource.isOwner[uint8_t id]() {
atomic {
! if(resId == id && state == RES_BUSY) return TRUE;
else return FALSE;
}
Index: SimpleArbiterP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/system/SimpleArbiterP.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** SimpleArbiterP.nc 15 Apr 2007 20:33:34 -0000 1.3
--- SimpleArbiterP.nc 24 Aug 2007 16:10:10 -0000 1.4
***************
*** 135,139 ****
*/
async command uint8_t ArbiterInfo.userId() {
! atomic return resId;
}
--- 135,143 ----
*/
async command uint8_t ArbiterInfo.userId() {
! atomic {
! if(state != RES_BUSY)
! return NO_RES;
! return resId;
! }
}
***************
*** 143,147 ****
async command uint8_t Resource.isOwner[uint8_t id]() {
atomic {
! if(resId == id) return TRUE;
else return FALSE;
}
--- 147,151 ----
async command uint8_t Resource.isOwner[uint8_t id]() {
atomic {
! if(resId == id && state == RES_BUSY) return TRUE;
else return FALSE;
}
More information about the Tinyos-2-commits
mailing list