[Twisted-Python] thread migration and bsddb

The 040518 release of CompStrm supports the movement of computational streams to a server thread and back to the main thread. See http://compstrm.sourceforge.net/thread.html Thread migration makes it very easy to do blocking I/O without comprimising the main thread. Unfortunatly, this is still not good enough when working with bsddb, as cursors are NOT thread free. To reuse a cursor, you must be on the SAME thread it was created on. ;-( A moderatly reasonable solution seems to be to have a thread dedicated to bsddb. Now the business logic can migrate to that thread, do a bunch of blocking I/O, and then migrate back to the main thread. It would then have the option of returning to the bsddb thread and resume processing with cursors it previously created. Mmm. Looks like its time for me to "put to practice" more of what I've read about Twisted. I'm thinking that managing the bsddb thread might be a Twisted Service--lots better than having each business object instance create its own thread. Bill la Forge http://www.geocities.com/laforge49/ Yahoo! India Matrimony: Find your partner online.

Bill la Forge wrote:
http://www.sleepycat.com/docs/ref/program/mt.html : "Transactions and cursors may span threads, but only serially, that is, the application must serialize access to the DB_TXN and DBC handles." Jp

Jp, Thankyou very very much. I had grossly mis-read that page. This means we can use the regular server threads rather than a dedicated thread, making for a much cleaner implementation. Bill Jp Calderone <exarkun@divmod.com> wrote: Bill la Forge wrote:
http://www.sleepycat.com/docs/ref/program/mt.html : "Transactions and cursors may span threads, but only serially, that is, the application must serialize access to the DB_TXN and DBC handles." Jp _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python Yahoo! India Matrimony: Find your partner online.

Bill la Forge wrote:
http://www.sleepycat.com/docs/ref/program/mt.html : "Transactions and cursors may span threads, but only serially, that is, the application must serialize access to the DB_TXN and DBC handles." Jp

Jp, Thankyou very very much. I had grossly mis-read that page. This means we can use the regular server threads rather than a dedicated thread, making for a much cleaner implementation. Bill Jp Calderone <exarkun@divmod.com> wrote: Bill la Forge wrote:
http://www.sleepycat.com/docs/ref/program/mt.html : "Transactions and cursors may span threads, but only serially, that is, the application must serialize access to the DB_TXN and DBC handles." Jp _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python Yahoo! India Matrimony: Find your partner online.
participants (2)
-
Bill la Forge
-
Jp Calderone