Issue #12607 has been updated by Dan0042 (Daniel DeLorme).


What is the use case for this atomic integer? I sometimes have a use for an=
 atomic monotonically increasing counter, but that could be satisfied with =
a very simple API like `n =3D MyCounter.next`
On the other hand I've never felt the need for decrement or reset or in fac=
t any integer atomic operations other than `+=3D 1`
2=A2

----------------------------------------
Feature #12607: Ruby needs an atomic integer
https://bugs.ruby-lang.org/issues/12607#change-89931

* Author: shyouhei (Shyouhei Urabe)
* Status: Feedback
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
----------------------------------------
(This one was derived from bug #12463)

Although I don't think +=3D would become atomic, at the same time I underst=
and Rodrigo's needs of _easier_ counter variable that resists inter-thread =
tampering.  I don't think ruby's Integer class can be used for that purpose=
 for reasons (mainly because it is not designed with threads in mind).  Rat=
her we should introduce a integer class which is carefully designed.

Why not import Concurrent::AtomicFixnum into core?



-- =

https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=3Dunsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>