module similar to Perl Net::Server
rayed
rayed at riy-01-s5.saudi.net.sa
Wed Feb 5 06:53:57 EST 2003
Thanks Andrew,
These are really nice features, but it add more complexity to the program.
Andrew Bennetts wrote:
> On Tue, Feb 04, 2003 at 02:56:49PM +0300, rayed wrote:
>
>>I need a database access, and I don't want to block other connections
>>when querying the database.
>
>
> That's ok. You can use twisted.enterprise.adbapi, which automatically wraps
> a DB-API 2.0 module into an asynchronous interface (it does the DB
> interactions in threads, and then fires an event in the main loop).
>
> Or if you prefer, you could use twisted.internet.threads.deferToThread,
> which will run a function in a thread, and fire a callback on a Deferred
> when done.
>
> Twisted is asynchronous, but it gives you convenient ways to work with
> blocking code when necessary.
>
> -Andrew.
>
>
More information about the Python-list
mailing list