Closed jonmorehouse closed 9 years ago
Hm yeah, it looks like the callbacks are invoked only on the thread that .succeed
etc are invoked on.
I think a new subclass, like EM::ThreadAwareDeferrable
, could solve this need (naming things is hard, not strongly opinionated about that one)
Cool. I'm working on something like this right now. Do you think its safe to store the queue or should we use a weakref?
I'm just thinking, if for some reason the original queue is garbage collected, how should we handle that?
Storing a reference to the queue should be fine - the queues themselves are lightweight, I believe
This is kind of a weird case I ran into ... but sometimes there is weird behavior when using DefaultDeferrables in the context of GCD.
So my understanding here is that while we would assume that the callback is invoked in the thread it was declared on, but that doesn't seem to be the case. I ran into some weird edge cases with this writing tests, using
wait
andwait_max
.What do you think of changing up the deferrable to automatically call the callback blocks on their origin thread?