开发者

Registering Thread Exit Callback for Pylons Threads

开发者 https://www.devze.com 2023-03-26 08:41 出处:网络
We have a Pylons WSGI app that lazily creates connections to a resource. That is to say, it uses a threading.local instance to see if a connection exists for the thread and creates one if it does not.

We have a Pylons WSGI app that lazily creates connections to a resource. That is to say, it uses a threading.local instance to see if a connection exists for the thread and creates one if it does not.

This solves the trick of o开发者_运维百科pening connections, but how can I close my connections properly when the thread exits? I can't find any information about how to be alerted when a thread is being terminated.

0

精彩评论

暂无评论...
验证码 换一张
取 消