[ruby-core:77146] [Ruby trunk Bug#12607] Ruby needs an atomic integer
From:
Ruby-Lang@...
Date:
2016-09-04 16:35:44 UTC
List:
ruby-core #77146
Issue #12607 has been updated by J旦rg W Mittag. Tsuyoshi Sawada wrote: > Do we want to have another integer variant just after having `Fixnum` and `Bignum` been excluded in favor of the `Integer` class? Well, it's not really another integer variant. It's really not a number at all. It's a concurrency primitive (that happens to be a number). ---------------------------------------- Bug #12607: Ruby needs an atomic integer https://bugs.ruby-lang.org/issues/12607#change-60361 * Author: Shyouhei Urabe * Status: Assigned * Priority: Normal * Assignee: Koichi Sasada * ruby -v: * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- (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: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>