Re: Look free ID genertion (was: Is there a more efficient threading lock?)

2023-03-02 Thread Dennis Lee Bieber
On Thu, 2 Mar 2023 12:45:50 +1100, Chris Angelico declaimed the following: > >As have all CPUs since; it's the only way to implement locks (push the >locking all the way down to the CPU level). > Xerox Sigma (circa 1970): Modify and Test (byte/halfword/word) Granted, that was a

Re: Look free ID genertion (was: Is there a more efficient threading lock?)

2023-03-01 Thread Jon Ribbens via Python-list
On 2023-03-02, Chris Angelico wrote: > On Thu, 2 Mar 2023 at 08:01, <2qdxy4rzwzuui...@potatochowder.com> wrote: >> On 2023-03-01 at 14:35:35 -0500, >> avi.e.gr...@gmail.com wrote: >> > What would have happened if all processors had been required to have >> > some low level instruction that

Re: Look free ID genertion (was: Is there a more efficient threading lock?)

2023-03-01 Thread Chris Angelico
On Thu, 2 Mar 2023 at 13:02, Weatherby,Gerard wrote: > > So I guess we know what would have happened. > Yep. It's not what I was talking about, but it's also a very important concurrency management feature. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: Look free ID genertion (was: Is there a more efficient threading lock?)

2023-03-01 Thread Weatherby,Gerard
So I guess we know what would have happened. Get Outlook for iOS<https://aka.ms/o0ukef> From: Python-list on behalf of Chris Angelico Sent: Wednesday, March 1, 2023 8:45:50 PM To: python-list@python.org Subject: Re: Look free ID genertion (was: Is there

Re: Look free ID genertion (was: Is there a more efficient threading lock?)

2023-03-01 Thread Chris Angelico
On Thu, 2 Mar 2023 at 08:01, <2qdxy4rzwzuui...@potatochowder.com> wrote: > > On 2023-03-01 at 14:35:35 -0500, > avi.e.gr...@gmail.com wrote: > > > What would have happened if all processors had been required to have > > some low level instruction that effectively did something in an atomic > > way

Re: Look free ID genertion (was: Is there a more efficient threading lock?)

2023-03-01 Thread 2QdxY4RzWzUUiLuE
On 2023-03-01 at 14:35:35 -0500, avi.e.gr...@gmail.com wrote: > What would have happened if all processors had been required to have > some low level instruction that effectively did something in an atomic > way that allowed a way for anyone using any language running on that > machine a way to

Re: Look free ID genertion (was: Is there a more efficient threading lock?)

2023-03-01 Thread Chris Angelico
On Thu, 2 Mar 2023 at 06:37, wrote: > > If a workaround like itertools.count.__next__() is used because it will not > be interrupted as it is implemented in C, then I have to ask if it would > make sense for Python to supply something similar in the standard library > for the sole purpose of a

RE: Look free ID genertion (was: Is there a more efficient threading lock?)

2023-03-01 Thread avi.e.gross
is very directly using the atomic operation directly. -Original Message- From: Python-list On Behalf Of Dieter Maurer Sent: Wednesday, March 1, 2023 1:43 PM To: Chris Angelico Cc: python-list@python.org Subject: Look free ID genertion (was: Is there a more efficient threading lock?) Chris

Look free ID genertion (was: Is there a more efficient threading lock?)

2023-03-01 Thread Dieter Maurer
Chris Angelico wrote at 2023-3-1 12:58 +1100: > ... > The >atomicity would be more useful in that context as it would give >lock-free ID generation, which doesn't work in Python. I have seen `itertools.count` for that. This works because its `__next__` is implemented in "C" and therefore will not