summaryrefslogtreecommitdiffstats
path: root/state.rb
diff options
context:
space:
mode:
authorCasey Dahlin <cdahlin@redhat.com>2008-10-07 13:12:09 -0400
committerCasey Dahlin <cdahlin@redhat.com>2008-10-07 13:12:09 -0400
commit4f924e0917167ff01623dbae73f9a5f401e6ff02 (patch)
tree55f8c2c3d984ae87a6a1274f3a1c1d2623cc133b /state.rb
parent8e15964e7bd73a6228652ef341d34f599b3c5345 (diff)
downloadupstate-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.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/state.rb b/state.rb
index eb2498a..993c6a8 100644
--- a/state.rb
+++ b/state.rb
@@ -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