From: ko1@... Date: 2021-01-13T07:32:13+00:00 Subject: [ruby-core:102056] [Ruby master Feature#12607] Ruby needs an atomic integer Issue #12607 has been updated by ko1 (Koichi Sasada). Eregon (Benoit Daloze) wrote in #note-25: > True, but an atomic integer remains useful even if there is an STM. > An STM is overkill and much slower if all someone wants is atomic counters. TVar proposed in https://bugs.ruby-lang.org/issues/17261 has `#increment` method and it is enough fast. ---------------------------------------- Feature #12607: Ruby needs an atomic integer https://bugs.ruby-lang.org/issues/12607#change-89912 * Author: shyouhei (Shyouhei Urabe) * Status: Feedback * Priority: Normal * Assignee: ko1 (Koichi Sasada) ---------------------------------------- (This one was derived from bug #12463) Although I don't think += would become atomic, at the same time I understand 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). Rather we should introduce a integer class which is carefully designed. Why not import Concurrent::AtomicFixnum into core? -- https://bugs.ruby-lang.org/ Unsubscribe: