On Wed, 1 Mar 2023 at 10:04, Barry <ba...@barrys-emacs.org> wrote:
>
> > Though it's still probably not as useful as you might hope. In C, if I
> > can do "int id = counter++;" atomically, it would guarantee me a new
> > ID that no other thread could ever have.
>
> C does not have to do that atomically. In fact it is free to use lots of 
> instructions to build the int value. And some compilers indeed do, the linux 
> kernel folks see this in gcc generated code.
>
> I understand you have to use the new atomics features.
>

Yeah, I didn't have a good analogy so I went with a hypothetical.  The
atomicity would be more useful in that context as it would give
lock-free ID generation, which doesn't work in Python.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to