using threads in twisted
for example, I want to run two tasks ( using threads ), waiting while this tasks is end and after run next several tasks ( using threads too ) How to do this using twi开发者_StackOverflow社区sted ? Any example ?
Actually combing threads and twisted is bad idea. The whole purpose of twisted is to actually model your code in such a way that it may run concurrently (without blocking) using it's deffered mechanism.
Having said that, if you have a task which cannot escape but will always block, there is a twisted construct available called deferToThread
which will execute that task in a separate thread and return the deferred to which you can attach your call back and errorback.
The twisted documentation provides an example for that. Hope you have looked at that.
精彩评论