Created
August 27, 2009 14:03
-
-
Save vangberg/176296 to your computer and use it in GitHub Desktop.
This file contains 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 session_initiated | |
set("foo", "bar") {} | |
# @queue: [Proc{}] | |
set("lol", "cat") {} | |
# @queue: [Proc{}] | |
read "/foo/bar.mp3" do |result| | |
.. | |
end | |
# @queue: [Proc{..}, Proc{update_session}] | |
end | |
# Now, the block supplied to read() is called at the fourth response. |
This file contains 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 session_initiated | |
set "foo", "bar" | |
# @queue: [] | |
set "lol", "cat" | |
# @queue: [] | |
read "/foo/bar.mp3" do |result| | |
.. | |
end | |
# @queue: [Proc{..}, Proc{update_session}] | |
end | |
# Now, both set(), set() and read() generates a response, which will | |
# call queue_pop. So the block supplied to read() will be called after | |
# the second response, which is the response to set(). This results in | |
# the block being called with *no* parameters–and too early–and thus a | |
# *foo called with wrong paramenters (0 for 1)* or something like that. | |
# Makes sense? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment