mutex_m 0.1.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{LICENSE.txt → BSDL} +3 -3
- data/COPYING +56 -0
- data/README.md +4 -2
- data/lib/mutex_m.rb +12 -9
- data/sig/mutex_m.rbs +99 -0
- metadata +15 -56
- data/Gemfile +0 -3
- data/Rakefile +0 -10
- data/mutex_m.gemspec +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1d54bf09d34079f64d7745f1f13ede292635a314d6e30bdef7ddea3d2b3d855
|
4
|
+
data.tar.gz: d7f4478cce1952483631888a054636dfe0d8e26675057530b2cffeb66df19ead
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b39170d0f5349bf8616bd67216e6c0288588d41f7b4f276c8940406e5004e39f657d427cc1a236bdaecf3ad3086795302234ed0fe8db87c4caa471166179ad77
|
7
|
+
data.tar.gz: c63393f5facdcebf2bf07d7df6e1be0a566fd10e54009ac2dc50cd5baf857a1561dd5a908d3c15be13d512e93803e72605348faa0e0db19fd4231136bc1aa721
|
data/{LICENSE.txt → BSDL}
RENAMED
@@ -4,10 +4,10 @@ Redistribution and use in source and binary forms, with or without
|
|
4
4
|
modification, are permitted provided that the following conditions
|
5
5
|
are met:
|
6
6
|
1. Redistributions of source code must retain the above copyright
|
7
|
-
notice, this list of conditions and the following disclaimer.
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
8
8
|
2. Redistributions in binary form must reproduce the above copyright
|
9
|
-
notice, this list of conditions and the following disclaimer in the
|
10
|
-
documentation and/or other materials provided with the distribution.
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
10
|
+
documentation and/or other materials provided with the distribution.
|
11
11
|
|
12
12
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
13
13
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
data/COPYING
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
|
2
|
+
You can redistribute it and/or modify it under either the terms of the
|
3
|
+
2-clause BSDL (see the file BSDL), or the conditions below:
|
4
|
+
|
5
|
+
1. You may make and give away verbatim copies of the source form of the
|
6
|
+
software without restriction, provided that you duplicate all of the
|
7
|
+
original copyright notices and associated disclaimers.
|
8
|
+
|
9
|
+
2. You may modify your copy of the software in any way, provided that
|
10
|
+
you do at least ONE of the following:
|
11
|
+
|
12
|
+
a. place your modifications in the Public Domain or otherwise
|
13
|
+
make them Freely Available, such as by posting said
|
14
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
15
|
+
the author to include your modifications in the software.
|
16
|
+
|
17
|
+
b. use the modified software only within your corporation or
|
18
|
+
organization.
|
19
|
+
|
20
|
+
c. give non-standard binaries non-standard names, with
|
21
|
+
instructions on where to get the original software distribution.
|
22
|
+
|
23
|
+
d. make other distribution arrangements with the author.
|
24
|
+
|
25
|
+
3. You may distribute the software in object code or binary form,
|
26
|
+
provided that you do at least ONE of the following:
|
27
|
+
|
28
|
+
a. distribute the binaries and library files of the software,
|
29
|
+
together with instructions (in the manual page or equivalent)
|
30
|
+
on where to get the original distribution.
|
31
|
+
|
32
|
+
b. accompany the distribution with the machine-readable source of
|
33
|
+
the software.
|
34
|
+
|
35
|
+
c. give non-standard binaries non-standard names, with
|
36
|
+
instructions on where to get the original software distribution.
|
37
|
+
|
38
|
+
d. make other distribution arrangements with the author.
|
39
|
+
|
40
|
+
4. You may modify and include the part of the software into any other
|
41
|
+
software (possibly commercial). But some files in the distribution
|
42
|
+
are not written by the author, so that they are not under these terms.
|
43
|
+
|
44
|
+
For the list of those files and their copying conditions, see the
|
45
|
+
file LEGAL.
|
46
|
+
|
47
|
+
5. The scripts and library files supplied as input to or produced as
|
48
|
+
output from the software do not automatically fall under the
|
49
|
+
copyright of the software, but belong to whomever generated them,
|
50
|
+
and may be sold commercially, and may be aggregated with this
|
51
|
+
software.
|
52
|
+
|
53
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
54
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
55
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
56
|
+
PURPOSE.
|
data/README.md
CHANGED
@@ -23,7 +23,7 @@ Or install it yourself as:
|
|
23
23
|
Start by requiring the standard library Mutex_m:
|
24
24
|
|
25
25
|
```ruby
|
26
|
-
require "mutex_m
|
26
|
+
require "mutex_m"
|
27
27
|
```
|
28
28
|
|
29
29
|
From here you can extend an object with Mutex instance methods:
|
@@ -34,10 +34,12 @@ 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
|
+
You should probably use `prepend` to mixin (if you use `include`, you need to
|
38
|
+
make sure that you call `super` inside `initialize`).
|
37
39
|
|
38
40
|
```ruby
|
39
41
|
class Foo
|
40
|
-
|
42
|
+
prepend Mutex_m
|
41
43
|
# ...
|
42
44
|
end
|
43
45
|
|
data/lib/mutex_m.rb
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
#
|
18
18
|
# Start by requiring the standard library Mutex_m:
|
19
19
|
#
|
20
|
-
# require "mutex_m
|
20
|
+
# require "mutex_m"
|
21
21
|
#
|
22
22
|
# From here you can extend an object with Mutex instance methods:
|
23
23
|
#
|
@@ -40,17 +40,20 @@
|
|
40
40
|
#
|
41
41
|
module Mutex_m
|
42
42
|
|
43
|
-
VERSION = "0.
|
43
|
+
VERSION = "0.3.0"
|
44
44
|
Ractor.make_shareable(VERSION) if defined?(Ractor)
|
45
45
|
|
46
46
|
def Mutex_m.define_aliases(cl) # :nodoc:
|
47
|
-
cl.
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
47
|
+
cl.alias_method(:locked?, :mu_locked?)
|
48
|
+
cl.alias_method(:lock, :mu_lock)
|
49
|
+
cl.alias_method(:unlock, :mu_unlock)
|
50
|
+
cl.alias_method(:try_lock, :mu_try_lock)
|
51
|
+
cl.alias_method(:synchronize, :mu_synchronize)
|
52
|
+
end
|
53
|
+
|
54
|
+
def Mutex_m.prepend_features(cl) # :nodoc:
|
55
|
+
super
|
56
|
+
define_aliases(cl) unless cl.instance_of?(Module)
|
54
57
|
end
|
55
58
|
|
56
59
|
def Mutex_m.append_features(cl) # :nodoc:
|
data/sig/mutex_m.rbs
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
# # mutex_m.rb
|
2
|
+
#
|
3
|
+
# When 'mutex_m' is required, any object that extends or includes Mutex_m will
|
4
|
+
# be treated like a Mutex.
|
5
|
+
#
|
6
|
+
# Start by requiring the standard library Mutex_m:
|
7
|
+
#
|
8
|
+
# require "mutex_m"
|
9
|
+
#
|
10
|
+
# From here you can extend an object with Mutex instance methods:
|
11
|
+
#
|
12
|
+
# obj = Object.new
|
13
|
+
# obj.extend Mutex_m
|
14
|
+
#
|
15
|
+
# Or mixin Mutex_m into your module to your class inherit Mutex instance methods
|
16
|
+
# --- remember to call super() in your class initialize method.
|
17
|
+
#
|
18
|
+
# class Foo
|
19
|
+
# include Mutex_m
|
20
|
+
# def initialize
|
21
|
+
# # ...
|
22
|
+
# super()
|
23
|
+
# end
|
24
|
+
# # ...
|
25
|
+
# end
|
26
|
+
# obj = Foo.new
|
27
|
+
# # this obj can be handled like Mutex
|
28
|
+
#
|
29
|
+
module Mutex_m
|
30
|
+
def self.append_features: (Module cl) -> untyped
|
31
|
+
|
32
|
+
def self.define_aliases: (Module cl) -> untyped
|
33
|
+
|
34
|
+
def self.extend_object: (Object obj) -> untyped
|
35
|
+
|
36
|
+
public
|
37
|
+
|
38
|
+
def mu_extended: () -> untyped
|
39
|
+
|
40
|
+
# <!--
|
41
|
+
# - mu_lock()
|
42
|
+
# -->
|
43
|
+
# See Thread::Mutex#lock
|
44
|
+
#
|
45
|
+
def mu_lock: () -> Thread::Mutex
|
46
|
+
|
47
|
+
# <!--
|
48
|
+
# - mu_locked?()
|
49
|
+
# -->
|
50
|
+
# See Thread::Mutex#locked?
|
51
|
+
#
|
52
|
+
def mu_locked?: () -> bool
|
53
|
+
|
54
|
+
# <!--
|
55
|
+
# - mu_synchronize(&block)
|
56
|
+
# -->
|
57
|
+
# See Thread::Mutex#synchronize
|
58
|
+
#
|
59
|
+
def mu_synchronize: [T] () { () -> T } -> T
|
60
|
+
|
61
|
+
# <!--
|
62
|
+
# - mu_try_lock()
|
63
|
+
# -->
|
64
|
+
# See Thread::Mutex#try_lock
|
65
|
+
#
|
66
|
+
def mu_try_lock: () -> bool
|
67
|
+
|
68
|
+
# <!--
|
69
|
+
# - mu_unlock()
|
70
|
+
# -->
|
71
|
+
# See Thread::Mutex#unlock
|
72
|
+
#
|
73
|
+
def mu_unlock: () -> Thread::Mutex
|
74
|
+
|
75
|
+
# <!--
|
76
|
+
# - sleep(timeout = nil)
|
77
|
+
# -->
|
78
|
+
# See Thread::Mutex#sleep
|
79
|
+
#
|
80
|
+
def sleep: (?Numeric timeout) -> Integer?
|
81
|
+
|
82
|
+
alias locked? mu_locked?
|
83
|
+
|
84
|
+
alias lock mu_lock
|
85
|
+
|
86
|
+
alias unlock mu_unlock
|
87
|
+
|
88
|
+
alias try_lock mu_try_lock
|
89
|
+
|
90
|
+
alias synchronize mu_synchronize
|
91
|
+
|
92
|
+
private
|
93
|
+
|
94
|
+
def initialize: (*untyped args) -> untyped
|
95
|
+
|
96
|
+
def mu_initialize: () -> untyped
|
97
|
+
end
|
98
|
+
|
99
|
+
Mutex_m::VERSION: String
|
metadata
CHANGED
@@ -1,57 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mutex_m
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keiju ISHITSUKA
|
8
|
-
autorequire:
|
9
|
-
bindir:
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: test-unit
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
11
|
+
date: 2024-11-20 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
55
13
|
description: Mixin to extend objects to be handled like a Mutex.
|
56
14
|
email:
|
57
15
|
- keiju@ruby-lang.org
|
@@ -59,18 +17,19 @@ executables: []
|
|
59
17
|
extensions: []
|
60
18
|
extra_rdoc_files: []
|
61
19
|
files:
|
62
|
-
-
|
63
|
-
-
|
20
|
+
- BSDL
|
21
|
+
- COPYING
|
64
22
|
- README.md
|
65
|
-
- Rakefile
|
66
23
|
- lib/mutex_m.rb
|
67
|
-
- mutex_m.
|
24
|
+
- sig/mutex_m.rbs
|
68
25
|
homepage: https://github.com/ruby/mutex_m
|
69
26
|
licenses:
|
70
27
|
- Ruby
|
71
28
|
- BSD-2-Clause
|
72
|
-
metadata:
|
73
|
-
|
29
|
+
metadata:
|
30
|
+
source_code_uri: https://github.com/ruby/mutex_m
|
31
|
+
bug_tracker_uri: https://github.com/ruby/mutex_m/issues
|
32
|
+
post_install_message:
|
74
33
|
rdoc_options: []
|
75
34
|
require_paths:
|
76
35
|
- lib
|
@@ -78,15 +37,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
37
|
requirements:
|
79
38
|
- - ">="
|
80
39
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
40
|
+
version: '2.5'
|
82
41
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
42
|
requirements:
|
84
43
|
- - ">="
|
85
44
|
- !ruby/object:Gem::Version
|
86
45
|
version: '0'
|
87
46
|
requirements: []
|
88
|
-
rubygems_version: 3.
|
89
|
-
signing_key:
|
47
|
+
rubygems_version: 3.5.11
|
48
|
+
signing_key:
|
90
49
|
specification_version: 4
|
91
50
|
summary: Mixin to extend objects to be handled like a Mutex.
|
92
51
|
test_files: []
|
data/Gemfile
DELETED
data/Rakefile
DELETED
data/mutex_m.gemspec
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require_relative "lib/mutex_m"
|
3
|
-
rescue LoadError
|
4
|
-
# for Ruby core repository
|
5
|
-
require_relative "mutex_m"
|
6
|
-
end
|
7
|
-
|
8
|
-
Gem::Specification.new do |spec|
|
9
|
-
spec.name = "mutex_m"
|
10
|
-
spec.version = Mutex_m::VERSION
|
11
|
-
spec.authors = ["Keiju ISHITSUKA"]
|
12
|
-
spec.email = ["keiju@ruby-lang.org"]
|
13
|
-
|
14
|
-
spec.summary = %q{Mixin to extend objects to be handled like a Mutex.}
|
15
|
-
spec.description = %q{Mixin to extend objects to be handled like a Mutex.}
|
16
|
-
spec.homepage = "https://github.com/ruby/mutex_m"
|
17
|
-
spec.licenses = ["Ruby", "BSD-2-Clause"]
|
18
|
-
|
19
|
-
spec.files = ["Gemfile", "LICENSE.txt", "README.md", "Rakefile", "lib/mutex_m.rb", "mutex_m.gemspec"]
|
20
|
-
spec.bindir = "exe"
|
21
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
-
spec.require_paths = ["lib"]
|
23
|
-
|
24
|
-
spec.add_development_dependency "bundler"
|
25
|
-
spec.add_development_dependency "rake"
|
26
|
-
spec.add_development_dependency "test-unit"
|
27
|
-
end
|