twisted里是通过回调机制来实现类似于多线程，意思是防止程序的运行由于等待某项任务的完成而陷入阻塞停滞，提高整体运行的效率。

from twisted.internet import reactor

Cause a function to be executed by the reactor thread.

Use this method when you want to run a function in the reactor's thread from another thread. Calling callFromThread should wake up the main thread (where reactor.run() is executing) and run the given callable in that thread.

If you're writing a multi-threaded application the callable may need to be thread safe, but this method doesn't require it as such. If you want to call a function in the next mainloop iteration, but you're in the same thread, use callLater with a delay of 0.

#coding=utf-8from twisted.internet import reactorimport timedef tt(i,j):    while 1:        print i,'---------------',j        time.sleep(1)reactor.callFromThread(tt,1,1)reactor.callFromThread(tt,4,2)reactor.run()