title: Python Twisted deferToThread function is not working as expected
body: <p>My goal here is to make a simple server handling TCP message like "process My String" that send "My String" to be processed by a quite time taking operation called (here slowFunction). Here I'm calling this function through deferToThread but nothing seems to happened : the defered's callback messages doesn't show up anywhere (breakpoints show it's never called) and the print in the function aren't displayed (breakpoints show it's never called)</p>
  
  <pre><code>from twisted import protocols
  from twisted.protocols import basic
  from twisted.internet import threads, protocol, reactor
  from twisted.application import service, internet
  import re
  import time
  
  def slowFunction(arg):
      print "starting process"
      time.sleep(1)
      print "processed "+arg
  
  class MySimpleServer(basic.LineReceiver):
  
      PROCESS_COMMAND = "process (.*)" #re pattern
      processFunction = slowFunction
      clients = []
  
      def connectionMade(self):
          print "Client connected"
          MySimpleServer.clients.append(self)
  
      def connectionLost(self, reason):
          print "Client gone"
          MySimpleServer.clients.remove(self)
  
      def onProcessDone(self):
          self.message("Process done")
  
      def onError(self):
          self.message("Process fail with error")
  
      def lineReceived(self, line):
          processArgumentResult = re.search(MySimpleServer.PROCESS_COMMAND, line)
          if not processArgumentResult == None:
              processArgument = processArgumentResult.groups()[0] 
              deferred = threads.deferToThread(MySimpleServer.processFunction, processArgument)
              deferred.addCallback(self.onProcessDone)
              deferred.addErrback(self.onError)
              self.message("processing your request")
          else:
              print "Unknown message line: "+line
  
      def message(self, message):
          self.transport.write(message + '\n')
  
  if __name__ == '__main__':
      factory = protocol.ServerFactory()
      factory.protocol = MySimpleServer
      factory.client = []
  
      reactor.listenTCP(8000, factory)
      reactor.run()
  </code></pre>