Claudiu
Claudiu

Reputation: 229301

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 that definitely won't come in with the reactor stopped.

Upvotes: 1

Views: 799

Answers (1)

Jean-Paul Calderone
Jean-Paul Calderone

Reputation: 48325

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.

Upvotes: 1

Related Questions