Multithread and locking issue

Cameron Simpson cs at cskk.id.au
Fri May 15 04:24:12 EDT 2020


On 15May2020 05:57, Stephane Tougard <stephane at sdf.org> wrote:
>On 2020-05-15, Chris Angelico <rosuav at gmail.com> wrote:
>> Seconded. If you know how many threads you're going to have, just 
>> open
>> that many connections. If not, there's a connection-pooling feature as
>> part of psycopg2 (if I'm not mistaken). This would be far far easier
>> to work with than a fragile queueing setup.
>
>I've done like that (more or less), it works fine.
>
>I note that que queuing module or Python is "fragile".

It isn't fragile, it is very robust. Chris' statement (to my mind) means 
either that it is an additional layer of complexity to your programme 
(which you need to debug) or the pervasive fear of threaded programming, 
which has its pitfalls but is very rewarding and not hard to do safely 
and easily unless you do something agressive and complex.

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Python-list mailing list