]> oss.titaniummirror.com Git - tinyos-2.x.git/commit
Fix possible overwrite of state changes make in a component's Init.init()
authorR. Steve McKown <rsmckown@gmail.com>
Mon, 19 Apr 2010 22:13:15 +0000 (16:13 -0600)
committerR. Steve McKown <rsmckown@gmail.com>
Thu, 22 Apr 2010 22:43:14 +0000 (16:43 -0600)
commitb34c3d8bdc4a0e98a0ba9ec200d392a89a50ea6d
tree63611e588b1b49f211259f2cbc633a89131be4dc
parent003c95e4890ae15d0f88b565d0e27b9a1a0b91aa
Fix possible overwrite of state changes make in a component's Init.init()

If a component using State and providing Init is wired to MainC.SoftwareInit,
the component cannot reliably call State.forceState() inside its Init.init().
If ncc renders MainC.SoftwareInit.Init()'s fanout calling the component's
Init.init() before StateImplP's Init.init(), the latter sets the state[] array
members all to zero (S_IDLE), undoing any state change the component may have
attempted.

The easy fix is to remove the extra initiation of state[] in StateImplP's
Init.init().  Becuase state[] is a static, its elements are guaranteed to have
values of zero (S_IDLE).
tos/system/StateImplP.nc