[Twisted-Python] Deferring execution to a specific thread

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 __________________________________ Do you Yahoo!? Win a $20,000 Career Makeover at Yahoo! HotJobs http://hotjobs.sweepstakes.yahoo.com/careermakeover

At 2004-05-01 05:22 AM -0700, you wrote:
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@SpinwardStars.com

Hi, --- Samuel Reynolds <sam@SpinwardStars.com> wrote:
Yes, only that using deferToThread does not guarantee that the operation will be deferred to the same thread. I thought about limiting the thread pool to exactly 1 thread but it is no option because in the future I might need othr usual worker threads. Anyway, I solved it using a custom thread and call in the main thread with callFromThread. I thought there might be a way to defer to a specific thread so I don't need to use custom threads but it's alright like this also. Sorin __________________________________ Do you Yahoo!? Win a $20,000 Career Makeover at Yahoo! HotJobs http://hotjobs.sweepstakes.yahoo.com/careermakeover

At 2004-05-01 05:22 AM -0700, you wrote:
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@SpinwardStars.com

Hi, --- Samuel Reynolds <sam@SpinwardStars.com> wrote:
Yes, only that using deferToThread does not guarantee that the operation will be deferred to the same thread. I thought about limiting the thread pool to exactly 1 thread but it is no option because in the future I might need othr usual worker threads. Anyway, I solved it using a custom thread and call in the main thread with callFromThread. I thought there might be a way to defer to a specific thread so I don't need to use custom threads but it's alright like this also. Sorin __________________________________ Do you Yahoo!? Win a $20,000 Career Makeover at Yahoo! HotJobs http://hotjobs.sweepstakes.yahoo.com/careermakeover
participants (2)
-
Samuel Reynolds
-
Sorin C.