summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorLuke Gruber <luke.gruber@shopify.com>2025-11-10 21:52:43 -0500
committerGitHub <noreply@github.com>2025-11-11 02:52:43 +0000
commit148fde27545ee35c8aab4ec7bca027184d79fbc4 (patch)
tree2126c6f3560204f5ec65c617e6939a784d9b6ce6 /internal
parent16c6f36039b14c983125db8144d791714035737b (diff)
Revert "ns_subclasses refcount accesses need to be atomic (#15083)" (#15138)
This reverts commit 2998c8d6b99ec49925ebea42198b29c3e27b34a7. We need to find a better way to fix this bug. Even with this refcount change, errors were still being seen in CI. For now we need to remove this failing test.
Diffstat (limited to 'internal')
-rw-r--r--internal/class.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/class.h b/internal/class.h
index d4306fc84d..f122d2f189 100644
--- a/internal/class.h
+++ b/internal/class.h
@@ -28,29 +28,29 @@
#endif
struct rb_box_subclasses {
- rb_atomic_t refcount;
+ long refcount;
struct st_table *tbl;
};
typedef struct rb_box_subclasses rb_box_subclasses_t;
-static inline rb_atomic_t
+static inline long
rb_box_subclasses_ref_count(rb_box_subclasses_t *box_sub)
{
- return ATOMIC_LOAD_RELAXED(box_sub->refcount);
+ return box_sub->refcount;
}
static inline rb_box_subclasses_t *
rb_box_subclasses_ref_inc(rb_box_subclasses_t *box_sub)
{
- RUBY_ATOMIC_FETCH_ADD(box_sub->refcount, 1);
+ box_sub->refcount++;
return box_sub;
}
static inline void
rb_box_subclasses_ref_dec(rb_box_subclasses_t *box_sub)
{
- rb_atomic_t was = RUBY_ATOMIC_FETCH_SUB(box_sub->refcount, 1);
- if (was == 1) {
+ box_sub->refcount--;
+ if (box_sub->refcount == 0) {
st_free_table(box_sub->tbl);
xfree(box_sub);
}