Michael S. Fischer
2007-Dec-01 18:08 UTC
[Eventmachine-talk] connection_completed never called after popen
Hi Francis, Is it possible to make EventMachine call the connection_completed method after a successful popen? I''m setting some variables in the block passed to popen but they''re not yet available to post_init at the time the latter function is called. Best regards, --Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20071201/12d78928/attachment.html
Francis Cianfrocca
2007-Dec-02 04:02 UTC
[Eventmachine-talk] connection_completed never called after
On Dec 1, 2007 9:08 PM, Michael S. Fischer <michael at dynamine.net> wrote:> Hi Francis, > > Is it possible to make EventMachine call the connection_completed method > after a successful popen? I''m setting some variables in the block passed to > popen but they''re not yet available to post_init at the time the latter > function is called. >No problem with this request in principle but can you give a code sample to show exactly what you''re trying to do? I''m not seeing the timing problem, and I''d like a unit test in any case. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20071202/e4319f8a/attachment.html
Michael S. Fischer
2007-Dec-02 09:30 UTC
[Eventmachine-talk] connection_completed never called after
On Dec 2, 2007 4:02 AM, Francis Cianfrocca <garbagecat10 at gmail.com> wrote:> On Dec 1, 2007 9:08 PM, Michael S. Fischer <michael at dynamine.net> wrote: > > > Hi Francis, > > > > Is it possible to make EventMachine call the connection_completed method > > after a successful popen? I''m setting some variables in the block passed to > > popen but they''re not yet available to post_init at the time the latter > > function is called. > > > > > No problem with this request in principle but can you give a code sample > to show exactly what you''re trying to do? I''m not seeing the timing problem, > and I''d like a unit test in any case. Thanks. >Sure, here''s an abstract test case: class Executor < EventMachine::Connection attr_accessor :command, :param def self.popen(command, param) conn = EventMachine::popen(command, self) do |conn| conn.command = command conn.param = param end end def post_init puts "#{@param}" # Race condition: @param not defined yet -> exception thrown end end Best regards, --Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20071202/40eb4741/attachment.html