twisted, unblock a threads.blockingCallFromThread when the reactor stops
it seems threads.blockingCallFromThread
keeps blocking even when the reactor stops. is there any way to un-block it? the deferred that it is blocking on relies on an RPC coming from the other end, and th开发者_运维知识库at definitely won't come in with the reactor stopped.
It blocks until the Deferred fires. If you want it to unblock, fire the Deferred. If you're stopping your application and stopping the reactor, then you might want to fire the Deferred before you do that. You probably want to fire it with a Failure
since presumably you haven't been able to come up with a successful result. You can install reactor shutdown hooks to run code when the reactor is about to stop, either using a custom Service
or reactor.addSystemEventTrigger
.
精彩评论