On Thu, 5 Mar 2009 15:49:31 -0800 (PST), khawar hasham 
<hasham_james_...@yahoo.com> wrote:
Hi,

I tried to use this suggestion but I could not make it work.

here is the test I am using

in my application class
def callSend(self, msg):
      plugin.send(msg)

Now in plugin class
def send(self, msg):
      print 'before call'
      threads.blockingCallFromThread(reactor, remotesend, msg)
      print 'after call'

def handleError(self, error):
      error.raiseException()

def remotesend(self, msg):
     deferred = defer.Deferred()
     reactor.connectTCP('localhost',9999,myfactory)
     deffered.addErrback(self.handleError)
     return deffered

now myfactory class .. clientConnectionFailed
def clientConnectionFailed(self, connector, reason):
      reason.raiseException()


now the problem is, code has become synchronous as code is waiting after 
threads.blockingCallFromThread, how to fire the defer returned from 
'remotesend'. Do i need to fire it or twisted will take care of it.

You probably need to fire it.  You created it, so it's your responsibility.
I don't know when you want it to fire, though.  What is it supposed to
represent?

I think I can't refer this deferred object since it is being passed to 
threads.blockingCallFromThread function on which I have no control.

Not only that, but you can't do anything with it outside the reactor thread.


any suggestions


What do you want to happen?

Jean-Paul

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to