diff options
author | Casey Dahlin <cdahlin@redhat.com> | 2008-10-07 13:12:09 -0400 |
---|---|---|
committer | Casey Dahlin <cdahlin@redhat.com> | 2008-10-07 13:12:09 -0400 |
commit | 4f924e0917167ff01623dbae73f9a5f401e6ff02 (patch) | |
tree | 55f8c2c3d984ae87a6a1274f3a1c1d2623cc133b /state.rb | |
parent | 8e15964e7bd73a6228652ef341d34f599b3c5345 (diff) | |
download | upstate-4f924e0917167ff01623dbae73f9a5f401e6ff02.tar.gz upstate-4f924e0917167ff01623dbae73f9a5f401e6ff02.tar.xz upstate-4f924e0917167ff01623dbae73f9a5f401e6ff02.zip |
Fix dependency issue with dropping.
A dropping state now holds its dependencies until after running the falling
edge, but shuts down its dependents before.
Diffstat (limited to 'state.rb')
-rw-r--r-- | state.rb | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -123,11 +123,7 @@ class State # Set this state to untrue def drop - return unless @active - trace "Dropping #{self}" - break_holds if @holds.size > 0 - becomes_defunct - self.class.falling_edge.call(params) + becomes_defunct(true) end # Parameters to this state @@ -137,10 +133,14 @@ class State end # Set this state to untrue without running any falling edge code - def becomes_defunct + def becomes_defunct(drop=false) return unless @active - break_holds if @holds.size > 0 @active = false + break_holds if @holds.size > 0 + if drop + trace "Dropping #{self}" + self.class.falling_edge.call(params) + end @deps.each{ |x| x.release(self) } State.gc State.depsolve_all |