Created
February 10, 2010 08:16
-
-
Save axgle/300125 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def open() | |
conts={} | |
callcc do |o| #o是open主节点 | |
callcc{|o1|#o1是子节点1 | |
conts[:o1]=o1 | |
puts "start 1" | |
o.call #跳到主节点后,子节点2不访问 | |
}#这里是o1节点后 | |
callcc{|o2|#o2是子节点2 | |
puts "start 2" | |
conts[:close].call#跳到close主节点后 | |
} | |
end#这里是open主节点后 | |
conts | |
end | |
def close(conts) | |
callcc do |c| | |
conts[:close]=c | |
conts[:o1].call #跳到open的o1节点后,然后访问o2节点 | |
end#这里是close主节点后 | |
puts "close" | |
end | |
conts=open | |
close(conts) | |
http://chinaonrails.com/topic/view/308.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment