Specifying `blocking` and `timeout` when acquiring lock as a context manager

Chris Angelico rosuav at gmail.com
Fri Aug 8 18:57:26 EDT 2014


On Sat, Aug 9, 2014 at 4:35 AM, Neil D. Cerutti <neilc at norwich.edu> wrote:
> Doesn't any natural looking use of blocking=False suffer from the same race
> condition? What's the correct way to use it?

Actually, I don't know. I try to avoid any form of thread locking
where possible, and I don't remember the last time I used
blocking=False at all. Generally, in those rare occasions when I want
to lock, I want to lock reliably, and it's around something so narrow
that the simple option will be the best. So you're quite probably
right.

ChrisA



More information about the Python-list mailing list