Module: Ratomic
- Defined in:
- lib/ratomic.rb,
lib/ratomic/map.rb,
lib/ratomic/pool.rb,
lib/ratomic/queue.rb,
lib/ratomic/counter.rb,
lib/ratomic/version.rb,
lib/ratomic/undefined.rb,
lib/ratomic/local_pool.rb
Overview
Ratomic provides mutable data structures for Ruby Ractors. Its primitives are backed by native Rust concurrency libraries so Ruby code can share useful state across Ractors without falling back to one global lock. ‘Pool` and `LocalPool` are pure Ruby primitives which use Ruby Ractor ownership and locality semantics instead of the native Rust path.
The public API currently includes Counter, Map, Queue, Pool, and LocalPool.
Defined Under Namespace
Classes: Counter, Error, LocalPool, Map, Pool, Queue, Undefined
Constant Summary collapse
- VERSION =
Current gem version string.
"0.4.0"- UNDEFINED =
Internal shareable missing-value sentinel.
Ractor.make_shareable(Undefined.new)
Class Method Summary collapse
- .development_native_extension_path ⇒ Object
- .load_native_extension_path(path) ⇒ Object
- .native_enabled? ⇒ Boolean
- .native_extension_path ⇒ Object
Class Method Details
.development_native_extension_path ⇒ Object
23 24 25 |
# File 'lib/ratomic.rb', line 23 def development_native_extension_path "ratomic/ratomic" end |
.load_native_extension_path(path) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/ratomic.rb', line 28 def load_native_extension_path(path) require_relative path true rescue LoadError false end |
.native_enabled? ⇒ Boolean
42 43 44 |
# File 'lib/ratomic.rb', line 42 def native_enabled? @native_enabled == true end |
.native_extension_path ⇒ Object
17 18 19 20 |
# File 'lib/ratomic.rb', line 17 def native_extension_path ruby_api_ver = RbConfig::CONFIG.fetch("ruby_version").split(".", 3)[0, 2].join(".") "ratomic/#{ruby_api_ver}/ratomic" end |