[Twisted-Python] Newbie Question: Running Twisted in a thread?
Hello, So Twisted can not be run inside a thread, and must be 'on top' and start my other threads? After reading: http://twistedmatrix.com/documents/current/howto/threading it looks like i will have to schedule my own threads to be run inside the twisted main event loop. What is the best way to make my threads thread safe? Will the code below work? from twisted.internet import reactor def myThread(value): print value time.sleep(1) reactor.callInThread(myThread, 1) reactor.run() so when reactor enters its mainloop via reactor.run() it will call once per loop myThread, is this correct? Will the call to myThread block all other threads, and it should be thread safe then, correct? Is there a way to have myThread called at a certian time interval? I'd like to update it at 30hz. My old code just looked like this: def myThread(value): time.sleep(0.333333) while 1: scene.render() thanks for the help, -brett __________________________________ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail
participants (1)
-
brett hartshorn