Is there a more efficient threading lock?
Jon Ribbens
jon+usenet at unequivocal.eu
Sat Feb 25 16:24:19 EST 2023
On 2023-02-25, Paul Rubin <no.email at nospam.invalid> wrote:
> Skip Montanaro <skip.montanaro at gmail.com> writes:
>> from threading import Lock
>
> 1) you generally want to use RLock rather than Lock
Why?
> 2) I have generally felt that using locks at the app level at all is an
> antipattern. The main way I've stayed sane in multi-threaded Python
> code is to have every mutable strictly owned by exactly one thread, pass
> values around using Queues, and have an event loop in each thread taking
> requests from Queues.
>
> 3) I didn't know that no-gil was a now thing and I'm used to having the
> GIL. So I would have considered the multiprocessing module rather than
> threading, for something like this.
What does this mean? Are you saying the GIL has been removed?
More information about the Python-list
mailing list