ratomic 0.2.0-x86_64-linux → 0.2.1-x86_64-linux
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +7 -2
- data/lib/ratomic/3.0/ratomic.so +0 -0
- data/lib/ratomic/3.1/ratomic.so +0 -0
- data/lib/ratomic/3.2/ratomic.so +0 -0
- data/lib/ratomic/3.3/ratomic.so +0 -0
- data/lib/ratomic/3.4/ratomic.so +0 -0
- data/lib/ratomic/4.0/ratomic.so +0 -0
- data/lib/ratomic/pool.rb +17 -1
- data/lib/ratomic/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b342a88351f8930ad904074de6a0210e1e8ed7523dbff36e5dc9c981b7450e58
|
|
4
|
+
data.tar.gz: 4bc6e2495415a993fd631112d3497c32564e550f2cb4aeee1990942b28ba8449
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4a9c078d8980fc788eba711420e596660e7b39c5d4031371aec30669a7db36f9aa35c8b5368fa4b68d2d4b716b940a52a120be2719282e4b75e68ef807522292
|
|
7
|
+
data.tar.gz: bb13dad126ea4b73358710a6bfae818f304287f9a1d3ef5de1100a664534abe1b016d2851d5dca06c7e759899cecb17a9437f305597dd5be9fde34754e97f908
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.2.1] - 2026-06-04
|
|
4
|
+
|
|
5
|
+
- Fix `Ratomic::Queue` slot indexing for non-power-of-two capacities.
|
|
6
|
+
- Fix `Ratomic::Map#fetch_and_modify` to propagate block exceptions instead of panicking.
|
|
7
|
+
|
|
3
8
|
## [0.2.0] - 2026-06-04
|
|
4
9
|
|
|
5
10
|
- Drop Ruby 3.x support and require Ruby 4.
|
data/README.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Ratomic
|
|
2
2
|
|
|
3
|
+
[](https://badge.fury.io/rb/ratomic)
|
|
4
|
+
[](https://github.com/mperham/ratomic/actions)
|
|
5
|
+
[](https://codecov.io/gh/mperham/ratomic)
|
|
6
|
+
[](https://www.ruby-lang.org/en/)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
|
|
9
|
+
|
|
3
10
|
Ratomic provides mutable data structures for use with Ruby's Ractors.
|
|
4
11
|
This allows Ruby code to scale beyond the infamous GVL.
|
|
5
12
|
|
|
@@ -31,8 +38,6 @@ Install the gem and add to the application's Gemfile by executing:
|
|
|
31
38
|
bundle add ratomic
|
|
32
39
|
```
|
|
33
40
|
|
|
34
|
-
TODO: We have not released a gem yet.
|
|
35
|
-
|
|
36
41
|
## Usage
|
|
37
42
|
|
|
38
43
|
Ratomic provides several useful Ractor-safe structures.
|
data/lib/ratomic/3.0/ratomic.so
CHANGED
|
Binary file
|
data/lib/ratomic/3.1/ratomic.so
CHANGED
|
Binary file
|
data/lib/ratomic/3.2/ratomic.so
CHANGED
|
Binary file
|
data/lib/ratomic/3.3/ratomic.so
CHANGED
|
Binary file
|
data/lib/ratomic/3.4/ratomic.so
CHANGED
|
Binary file
|
data/lib/ratomic/4.0/ratomic.so
CHANGED
|
Binary file
|
data/lib/ratomic/pool.rb
CHANGED
|
@@ -73,6 +73,20 @@ module Ratomic
|
|
|
73
73
|
nil
|
|
74
74
|
end
|
|
75
75
|
|
|
76
|
+
# Stop the private coordinator Ractor.
|
|
77
|
+
#
|
|
78
|
+
# This is primarily useful for tests and short-lived scripts. A closed pool
|
|
79
|
+
# should not be used for further checkout/checkin operations.
|
|
80
|
+
#
|
|
81
|
+
# @return [nil]
|
|
82
|
+
def close
|
|
83
|
+
@control << [:shutdown]
|
|
84
|
+
@control.value
|
|
85
|
+
nil
|
|
86
|
+
rescue Ractor::ClosedError, Ractor::Error
|
|
87
|
+
nil
|
|
88
|
+
end
|
|
89
|
+
|
|
76
90
|
# Checkout an object, yield it, then move it back to the pool.
|
|
77
91
|
#
|
|
78
92
|
# This is the preferred API because it guarantees checkin through an ensure
|
|
@@ -101,7 +115,7 @@ module Ratomic
|
|
|
101
115
|
|
|
102
116
|
loop do
|
|
103
117
|
command, *args = Ractor.receive
|
|
104
|
-
handle_command(command, args, available, waiting)
|
|
118
|
+
break if handle_command(command, args, available, waiting) == :shutdown
|
|
105
119
|
end
|
|
106
120
|
end
|
|
107
121
|
private_class_method :run_control_loop
|
|
@@ -114,6 +128,8 @@ module Ratomic
|
|
|
114
128
|
handle_checkin(args.fetch(0), available, waiting)
|
|
115
129
|
when :cancel
|
|
116
130
|
waiting.delete(args.fetch(0))
|
|
131
|
+
when :shutdown
|
|
132
|
+
:shutdown
|
|
117
133
|
end
|
|
118
134
|
end
|
|
119
135
|
private_class_method :handle_command
|
data/lib/ratomic/version.rb
CHANGED