atomic-ruby 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10b5f273dd24628d2bf10a095cb875647bc922fc36697528c472053c61b2822c
4
- data.tar.gz: b1b45d921decbc9bd2f927b8b6ed11a8de9e36ca1acacd4dde411953992ffb3a
3
+ metadata.gz: 57accb1881812e461319bfe99a9212bc9203950c6c65339fae8254e62f5caa4b
4
+ data.tar.gz: cbcbb08d46e110fb7b9142a557a54bdcdeceaed7cc8cf199f7dd889357427fea
5
5
  SHA512:
6
- metadata.gz: c5ed7e71b51fa5b45e7031c7a08399f0158c588f3fe5b64844f7511fd959ebe7735fcc042d61b84c05729b961a133e7fa12a84663fe2e791b79fe3d02d6319f1
7
- data.tar.gz: cd538c8c88fa9aa636ae0c0c69063b8288cde1af7b533c958c76096a7ecede7967ab45159ca04d010d507e084b8b13c38aa225d2ba675b146d2c7e8c473d147f
6
+ metadata.gz: 03ff73d5a5d88a009392315df158e8bf3a4fbf46b4368c25d44d5a811818cd720017971d03384e93aaa6388cb3e1ffe0d214867aa89d17013b241c4fa1cb76fd
7
+ data.tar.gz: '029ba73ff27645c28ad080a3511614cf9cb4f4fd8ba87eb1248f3616cb2cb4590426989ebd9b9ff6a4e1bd9e068122b3dd066c6098c38aad6301ee370c4f62af'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.6.0] - 2025-10-15
4
+
5
+ - Make `Atom`, `AtomicBoolean`, and `AtomicCountDownLatch` Ractor shareable
6
+
7
+ ## [0.5.1] - 2025-07-26
8
+
9
+ - Revert `wrap_struct_name` back to `AtomicRuby::Atom`
10
+
3
11
  ## [0.5.0] - 2025-07-17
4
12
 
5
13
  - Add shortcut aliases for `AtomicRuby` namespaced classes
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  ![Version](https://img.shields.io/gem/v/atomic-ruby)
4
4
  ![Build](https://img.shields.io/github/actions/workflow/status/joshuay03/atomic-ruby/.github/workflows/main.yml?branch=main)
5
5
 
6
- Atomic primitives for Ruby.
6
+ Atomic ([CAS](https://en.wikipedia.org/wiki/Compare-and-swap)) primitives for Ruby.
7
7
 
8
8
  ## Installation
9
9
 
@@ -24,14 +24,14 @@ static void atomic_ruby_atom_compact(void *ptr) {
24
24
  }
25
25
 
26
26
  static const rb_data_type_t atomic_ruby_atom_type = {
27
- .wrap_struct_name = "Atom",
27
+ .wrap_struct_name = "AtomicRuby::Atom",
28
28
  .function = {
29
29
  .dmark = atomic_ruby_atom_mark,
30
30
  .dfree = atomic_ruby_atom_free,
31
31
  .dsize = atomic_ruby_atom_memsize,
32
32
  .dcompact = atomic_ruby_atom_compact
33
33
  },
34
- .flags = RUBY_TYPED_FREE_IMMEDIATELY
34
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_FROZEN_SHAREABLE
35
35
  };
36
36
 
37
37
  static VALUE rb_cAtom_allocate(VALUE klass) {
@@ -75,4 +75,8 @@ RUBY_FUNC_EXPORTED void Init_atomic_ruby(void) {
75
75
  rb_define_method(rb_cAtom, "_initialize", rb_cAtom_initialize, 1);
76
76
  rb_define_method(rb_cAtom, "_value", rb_cAtom_value, 0);
77
77
  rb_define_method(rb_cAtom, "_swap", rb_cAtom_swap, 0);
78
+
79
+ #ifdef HAVE_RB_EXT_RACTOR_SAFE
80
+ rb_ext_ractor_safe(true);
81
+ #endif
78
82
  }
@@ -4,6 +4,8 @@ module AtomicRuby
4
4
  class Atom
5
5
  def initialize(value)
6
6
  _initialize(value)
7
+
8
+ Ractor.make_shareable(self)
7
9
  end
8
10
 
9
11
  def value
@@ -12,6 +12,8 @@ module AtomicRuby
12
12
  end
13
13
 
14
14
  @boolean = Atom.new(value)
15
+
16
+ Ractor.make_shareable(self)
15
17
  end
16
18
 
17
19
  def value
@@ -13,6 +13,8 @@ module AtomicRuby
13
13
  end
14
14
 
15
15
  @count = Atom.new(count)
16
+
17
+ Ractor.make_shareable(self)
16
18
  end
17
19
 
18
20
  def count
Binary file
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AtomicRuby
4
- VERSION = "0.5.0"
4
+ VERSION = "0.6.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atomic-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Young