mutex_m 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -2
- data/README.md +13 -12
- data/lib/mutex_m.rb +9 -7
- data/mutex_m.gemspec +2 -2
- metadata +7 -11
- data/.gitignore +0 -9
- data/.travis.yml +0 -6
- data/bin/console +0 -7
- data/bin/setup +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 389c43478a26e3bc30dc387d92d0149034f3e890287a40063f600ab994db843a
|
4
|
+
data.tar.gz: ca465e9e47b3fe2eaec3bbf194e066c30e39a6b8101aed4a04043fdd11198ca3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7aef07f0fbd0f288e2baf81d07b5ea8647412477c5d74e124c70706712c1081ced417628c554097103f6dba5625e4a080e483ff45c366df1f8f6a600a20e2f6c
|
7
|
+
data.tar.gz: bab89102486ae0f41895647b2b19c5020c9424bb271fcb4d7092405b5d69d9b91da88f2c69d0790cf57aaf2356ed32bb3b044f1eeb26a692b89cdaa922ceadb6
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -22,27 +22,28 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
Start by requiring the standard library Mutex_m:
|
24
24
|
|
25
|
-
```
|
26
|
-
|
25
|
+
```ruby
|
26
|
+
require "mutex_m.rb"
|
27
27
|
```
|
28
28
|
|
29
29
|
From here you can extend an object with Mutex instance methods:
|
30
30
|
|
31
|
-
```
|
32
|
-
|
33
|
-
|
31
|
+
```ruby
|
32
|
+
obj = Object.new
|
33
|
+
obj.extend Mutex_m
|
34
34
|
```
|
35
35
|
|
36
36
|
Or mixin Mutex_m into your module to your class inherit Mutex instance methods.
|
37
37
|
|
38
|
+
```ruby
|
39
|
+
class Foo
|
40
|
+
include Mutex_m
|
41
|
+
# ...
|
42
|
+
end
|
43
|
+
|
44
|
+
obj = Foo.new
|
45
|
+
# this obj can be handled like Mutex
|
38
46
|
```
|
39
|
-
class Foo
|
40
|
-
include Mutex_m
|
41
|
-
# ...
|
42
|
-
end
|
43
|
-
obj = Foo.new
|
44
|
-
# this obj can be handled like Mutex
|
45
|
-
g```
|
46
47
|
|
47
48
|
## Development
|
48
49
|
|
data/lib/mutex_m.rb
CHANGED
@@ -40,7 +40,8 @@
|
|
40
40
|
#
|
41
41
|
module Mutex_m
|
42
42
|
|
43
|
-
VERSION = "0.1.
|
43
|
+
VERSION = "0.1.2"
|
44
|
+
Ractor.make_shareable(VERSION) if defined?(Ractor)
|
44
45
|
|
45
46
|
def Mutex_m.define_aliases(cl) # :nodoc:
|
46
47
|
cl.module_eval %q{
|
@@ -73,32 +74,32 @@ module Mutex_m
|
|
73
74
|
mu_initialize
|
74
75
|
end
|
75
76
|
|
76
|
-
# See Mutex#synchronize
|
77
|
+
# See Thread::Mutex#synchronize
|
77
78
|
def mu_synchronize(&block)
|
78
79
|
@_mutex.synchronize(&block)
|
79
80
|
end
|
80
81
|
|
81
|
-
# See Mutex#locked?
|
82
|
+
# See Thread::Mutex#locked?
|
82
83
|
def mu_locked?
|
83
84
|
@_mutex.locked?
|
84
85
|
end
|
85
86
|
|
86
|
-
# See Mutex#try_lock
|
87
|
+
# See Thread::Mutex#try_lock
|
87
88
|
def mu_try_lock
|
88
89
|
@_mutex.try_lock
|
89
90
|
end
|
90
91
|
|
91
|
-
# See Mutex#lock
|
92
|
+
# See Thread::Mutex#lock
|
92
93
|
def mu_lock
|
93
94
|
@_mutex.lock
|
94
95
|
end
|
95
96
|
|
96
|
-
# See Mutex#unlock
|
97
|
+
# See Thread::Mutex#unlock
|
97
98
|
def mu_unlock
|
98
99
|
@_mutex.unlock
|
99
100
|
end
|
100
101
|
|
101
|
-
# See Mutex#sleep
|
102
|
+
# See Thread::Mutex#sleep
|
102
103
|
def sleep(timeout = nil)
|
103
104
|
@_mutex.sleep(timeout)
|
104
105
|
end
|
@@ -113,4 +114,5 @@ module Mutex_m
|
|
113
114
|
mu_initialize
|
114
115
|
super
|
115
116
|
end
|
117
|
+
ruby2_keywords(:initialize) if respond_to?(:ruby2_keywords, true)
|
116
118
|
end
|
data/mutex_m.gemspec
CHANGED
@@ -14,9 +14,9 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.summary = %q{Mixin to extend objects to be handled like a Mutex.}
|
15
15
|
spec.description = %q{Mixin to extend objects to be handled like a Mutex.}
|
16
16
|
spec.homepage = "https://github.com/ruby/mutex_m"
|
17
|
-
spec.
|
17
|
+
spec.licenses = ["Ruby", "BSD-2-Clause"]
|
18
18
|
|
19
|
-
spec.files = ["
|
19
|
+
spec.files = ["Gemfile", "LICENSE.txt", "README.md", "Rakefile", "lib/mutex_m.rb", "mutex_m.gemspec"]
|
20
20
|
spec.bindir = "exe"
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mutex_m
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keiju ISHITSUKA
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -59,21 +59,18 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- ".gitignore"
|
63
|
-
- ".travis.yml"
|
64
62
|
- Gemfile
|
65
63
|
- LICENSE.txt
|
66
64
|
- README.md
|
67
65
|
- Rakefile
|
68
|
-
- bin/console
|
69
|
-
- bin/setup
|
70
66
|
- lib/mutex_m.rb
|
71
67
|
- mutex_m.gemspec
|
72
68
|
homepage: https://github.com/ruby/mutex_m
|
73
69
|
licenses:
|
70
|
+
- Ruby
|
74
71
|
- BSD-2-Clause
|
75
72
|
metadata: {}
|
76
|
-
post_install_message:
|
73
|
+
post_install_message:
|
77
74
|
rdoc_options: []
|
78
75
|
require_paths:
|
79
76
|
- lib
|
@@ -88,9 +85,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
85
|
- !ruby/object:Gem::Version
|
89
86
|
version: '0'
|
90
87
|
requirements: []
|
91
|
-
|
92
|
-
|
93
|
-
signing_key:
|
88
|
+
rubygems_version: 3.4.0.dev
|
89
|
+
signing_key:
|
94
90
|
specification_version: 4
|
95
91
|
summary: Mixin to extend objects to be handled like a Mutex.
|
96
92
|
test_files: []
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/bin/console
DELETED