rubysl-mutex_m 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -6
- data/lib/rubysl/mutex_m/mutex_m.rb +59 -47
- data/lib/rubysl/mutex_m/version.rb +1 -1
- data/rubysl-mutex_m.gemspec +0 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e62e79371da28c8eeaf1c32a6b0d0c31adac9a8d
|
4
|
+
data.tar.gz: 9cadf9530abe49552f379e92520d6eb5b3d81c78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e582d162a426f40077699371f3772fd763c22ff360ff0e80b04166bc0df62fcdb61f85ecf6f7f543bb2ca52b4f2efda071e4cdc2a6ca0ffd411c4db90542898c
|
7
|
+
data.tar.gz: d1b086d3647c7ead586dd0dcdfba13e1144caca6cc265b1589ed23be6b2a1372c5389f0b3baf236e313bd604d3ce174001a6beda4a9d5bbdf848ea08b4e80b0e
|
data/.travis.yml
CHANGED
@@ -1,38 +1,43 @@
|
|
1
|
-
|
2
|
-
# mutex_m.rb -
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# $Date$
|
1
|
+
#
|
2
|
+
# mutex_m.rb -
|
3
|
+
# $Release Version: 3.0$
|
4
|
+
# $Revision: 1.7 $
|
6
5
|
# Original from mutex.rb
|
7
|
-
#
|
6
|
+
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
|
8
7
|
# modified by matz
|
9
8
|
# patched by akira yamada
|
10
|
-
# gutted by MenTaLguY
|
11
|
-
#++
|
12
9
|
#
|
13
|
-
#
|
10
|
+
# --
|
11
|
+
|
12
|
+
|
13
|
+
require 'thread'
|
14
|
+
|
15
|
+
# = mutex_m.rb
|
16
|
+
#
|
17
|
+
# When 'mutex_m' is required, any object that extends or includes Mutex_m will
|
18
|
+
# be treated like a Mutex.
|
14
19
|
#
|
15
|
-
#
|
20
|
+
# Start by requiring the standard library Mutex_m:
|
16
21
|
#
|
17
22
|
# require "mutex_m.rb"
|
23
|
+
#
|
24
|
+
# From here you can extend an object with Mutex instance methods:
|
25
|
+
#
|
18
26
|
# obj = Object.new
|
19
27
|
# obj.extend Mutex_m
|
20
|
-
# # ...
|
21
28
|
#
|
22
|
-
# Or
|
23
|
-
#
|
29
|
+
# Or mixin Mutex_m into your module to your class inherit Mutex instance
|
30
|
+
# methods.
|
24
31
|
#
|
25
32
|
# class Foo
|
26
33
|
# include Mutex_m
|
27
34
|
# # ...
|
28
35
|
# end
|
29
|
-
#
|
30
36
|
# obj = Foo.new
|
31
|
-
|
32
|
-
|
33
|
-
|
37
|
+
# # this obj can be handled like Mutex
|
38
|
+
#
|
34
39
|
module Mutex_m
|
35
|
-
def Mutex_m.define_aliases(cl)
|
40
|
+
def Mutex_m.define_aliases(cl) # :nodoc:
|
36
41
|
cl.module_eval %q{
|
37
42
|
alias locked? mu_locked?
|
38
43
|
alias lock mu_lock
|
@@ -40,59 +45,66 @@ module Mutex_m
|
|
40
45
|
alias try_lock mu_try_lock
|
41
46
|
alias synchronize mu_synchronize
|
42
47
|
}
|
43
|
-
end
|
48
|
+
end
|
44
49
|
|
45
|
-
def Mutex_m.append_features(cl)
|
50
|
+
def Mutex_m.append_features(cl) # :nodoc:
|
46
51
|
super
|
47
52
|
define_aliases(cl) unless cl.instance_of?(Module)
|
48
53
|
end
|
49
|
-
|
50
|
-
def Mutex_m.extend_object(obj)
|
54
|
+
|
55
|
+
def Mutex_m.extend_object(obj) # :nodoc:
|
51
56
|
super
|
52
57
|
obj.mu_extended
|
53
58
|
end
|
54
59
|
|
55
|
-
def mu_extended
|
60
|
+
def mu_extended # :nodoc:
|
56
61
|
unless (defined? locked? and
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
Mutex_m.define_aliases(
|
62
|
+
defined? lock and
|
63
|
+
defined? unlock and
|
64
|
+
defined? try_lock and
|
65
|
+
defined? synchronize)
|
66
|
+
Mutex_m.define_aliases(singleton_class)
|
62
67
|
end
|
63
68
|
mu_initialize
|
64
69
|
end
|
65
|
-
|
66
|
-
#
|
67
|
-
def mu_synchronize
|
68
|
-
@
|
70
|
+
|
71
|
+
# See Mutex#synchronize
|
72
|
+
def mu_synchronize(&block)
|
73
|
+
@_mutex.synchronize(&block)
|
69
74
|
end
|
70
|
-
|
75
|
+
|
76
|
+
# See Mutex#locked?
|
71
77
|
def mu_locked?
|
72
|
-
@
|
78
|
+
@_mutex.locked?
|
73
79
|
end
|
74
|
-
|
80
|
+
|
81
|
+
# See Mutex#try_lock
|
75
82
|
def mu_try_lock
|
76
|
-
@
|
83
|
+
@_mutex.try_lock
|
77
84
|
end
|
78
|
-
|
85
|
+
|
86
|
+
# See Mutex#lock
|
79
87
|
def mu_lock
|
80
|
-
@
|
81
|
-
self
|
88
|
+
@_mutex.lock
|
82
89
|
end
|
83
|
-
|
90
|
+
|
91
|
+
# See Mutex#unlock
|
84
92
|
def mu_unlock
|
85
|
-
@
|
86
|
-
|
93
|
+
@_mutex.unlock
|
94
|
+
end
|
95
|
+
|
96
|
+
# See Mutex#sleep
|
97
|
+
def sleep(timeout = nil)
|
98
|
+
@_mutex.sleep(timeout)
|
87
99
|
end
|
88
|
-
|
100
|
+
|
89
101
|
private
|
90
|
-
|
91
|
-
def mu_initialize
|
92
|
-
@
|
102
|
+
|
103
|
+
def mu_initialize # :nodoc:
|
104
|
+
@_mutex = Mutex.new
|
93
105
|
end
|
94
106
|
|
95
|
-
def initialize(*args)
|
107
|
+
def initialize(*args) # :nodoc:
|
96
108
|
mu_initialize
|
97
109
|
super
|
98
110
|
end
|
data/rubysl-mutex_m.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubysl-mutex_m
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Shirai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.5'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubysl-prettyprint
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '1.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ~>
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '1.0'
|
69
55
|
description: Ruby standard library mutex_m.
|
70
56
|
email:
|
71
57
|
- brixen@gmail.com
|