[Twisted-Python] Deferring execution to a specific thread

Samuel Reynolds sam at SpinwardStars.com
Sat May 1 12:23:54 EDT 2004


At 2004-05-01 05:22 AM -0700, you wrote:
>Hello everybody,
>
>I looked at twisted interaction with threads but I
>couldn't find a way to defer execution to a specific
>thread. I need this because I have exactly one
>connection (no more connections possible) to the
>database and all database operations have to be placed
>in the same thread.
>Is there a way to handle situations like this? Any
>suggestion appreciated.
>
>Thanks,
>Sorin

Maybe...
Post the deferred to a queue *and* return it to the caller;
only the query thread reads from that queue. On completion
of the query, mark the deferred complete (is that right, gurus?)
and delete it from the queue.

- Sam

__________________________________________________________
Spinward Stars, LLC                        Samuel Reynolds
Software Consulting and Development           303-805-1446
http://SpinwardStars.com/            sam at SpinwardStars.com 





More information about the Twisted-Python mailing list