rubysl-thread 1.0.0 → 2.0.2
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 +14 -6
- data/.travis.yml +7 -5
- data/lib/rubysl/thread/thread.rb +0 -91
- data/lib/rubysl/thread/version.rb +1 -1
- data/rubysl-thread.gemspec +3 -0
- metadata +32 -16
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NDMzN2U4MGQ0ZWYxYTA3ZTZmYjczMzM4NzYwZWQ0ODA0ZGJjNjVlNA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
M2JhOTY1MTE3NDYyZmYwNDA5YmE4ZWU4NjE0M2U1MmY4Yjg1NTg0OQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MDI5Y2MxMWQ2NzA2YTUyYjA0YmUwMWYyYzk4YjFkZDZjMThiNzgxMDIzMjc4
|
10
|
+
NWEyMDUxYWFhNmRkNjVmNDY5NWM4NzYxYzk1MjJlOGExZGIzMmZhMGFlMmI4
|
11
|
+
NmE0OTUzMjhhMDFjODAxMzA2YWVjNTIxODk4MGE2NmVkMTdhZWU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MWY2ZWJmNDZjYjQ5ZmZkZTZhZmNmMjEyOTU0NWM4OTZjNmVkZDM1NmJhYzJm
|
14
|
+
YjI1NzdlNDZjOWVkZDk3ODdkNjlhODllNDljZjcyNGZkMzc1YTUwZWRmZWM4
|
15
|
+
ZTFmNTI4NzQ1ODkzMWUwMjFkMDVjYjU4ZmVmZmRlYTQ3NDYwMjA=
|
data/.travis.yml
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
language: ruby
|
2
|
+
before_install:
|
3
|
+
- rvm use $RVM --install --binary --fuzzy
|
4
|
+
- gem update --system
|
5
|
+
- gem --version
|
6
|
+
- gem install rubysl-bundler
|
2
7
|
env:
|
3
|
-
- RUBYLIB=lib
|
4
|
-
script: bundle exec mspec
|
5
|
-
rvm:
|
6
|
-
- 1.8.7
|
7
|
-
- rbx-nightly-18mode
|
8
|
+
- RVM=rbx-nightly-d21 RUBYLIB=lib
|
9
|
+
script: bundle exec mspec spec
|
data/lib/rubysl/thread/thread.rb
CHANGED
@@ -8,101 +8,10 @@
|
|
8
8
|
# Copyright (C) 2000 Information-technology Promotion Agency, Japan
|
9
9
|
#
|
10
10
|
|
11
|
-
unless defined? Thread
|
12
|
-
raise "Thread not available for this ruby interpreter"
|
13
|
-
end
|
14
|
-
|
15
|
-
unless defined? ThreadError
|
16
|
-
class ThreadError < StandardError
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
11
|
if $DEBUG
|
21
12
|
Thread.abort_on_exception = true
|
22
13
|
end
|
23
14
|
|
24
|
-
class Thread
|
25
|
-
#
|
26
|
-
# Wraps a block in Thread.critical, restoring the original value upon exit
|
27
|
-
# from the critical section.
|
28
|
-
#
|
29
|
-
def Thread.exclusive
|
30
|
-
_old = Thread.critical
|
31
|
-
begin
|
32
|
-
Thread.critical = true
|
33
|
-
return yield
|
34
|
-
ensure
|
35
|
-
Thread.critical = _old
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
class Mutex
|
41
|
-
def initialize
|
42
|
-
@owner = nil
|
43
|
-
end
|
44
|
-
|
45
|
-
# Check and only allow it to be marshal'd if there are no waiters.
|
46
|
-
def marshal_dump
|
47
|
-
raise "Unable to dump locked mutex" unless @waiters.empty?
|
48
|
-
1
|
49
|
-
end
|
50
|
-
|
51
|
-
# Implemented because we must since we use marshal_load PLUS we need
|
52
|
-
# to create AND prime @lock. If we didn't do this, then Marshal
|
53
|
-
# wouldn't prime the lock anyway.
|
54
|
-
def marshal_load(bunk)
|
55
|
-
initialize
|
56
|
-
end
|
57
|
-
|
58
|
-
def locked?
|
59
|
-
Rubinius.locked?(self)
|
60
|
-
end
|
61
|
-
|
62
|
-
def try_lock
|
63
|
-
# Locking implies a memory barrier, so we don't need to use
|
64
|
-
# one explicitly.
|
65
|
-
if Rubinius.try_lock(self)
|
66
|
-
@owner = Thread.current
|
67
|
-
true
|
68
|
-
else
|
69
|
-
false
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def lock
|
74
|
-
Rubinius.memory_barrier
|
75
|
-
if @owner == Thread.current
|
76
|
-
raise ThreadError, "Recursively locking not allowed"
|
77
|
-
end
|
78
|
-
|
79
|
-
Rubinius.lock self
|
80
|
-
@owner = Thread.current
|
81
|
-
Rubinius.memory_barrier
|
82
|
-
return self
|
83
|
-
end
|
84
|
-
|
85
|
-
def unlock
|
86
|
-
Rubinius.memory_barrier
|
87
|
-
|
88
|
-
if @owner != Thread.current
|
89
|
-
raise ThreadError, "#{Thread.current.inspect} not owner, #{@owner.inspect} is"
|
90
|
-
end
|
91
|
-
|
92
|
-
@owner = nil
|
93
|
-
Rubinius.unlock self
|
94
|
-
end
|
95
|
-
|
96
|
-
def synchronize
|
97
|
-
lock
|
98
|
-
begin
|
99
|
-
yield
|
100
|
-
ensure
|
101
|
-
unlock
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
15
|
#
|
107
16
|
# ConditionVariable objects augment class Mutex. Using condition variables,
|
108
17
|
# it is possible to suspend while in the middle of a critical section until a
|
data/rubysl-thread.gemspec
CHANGED
@@ -16,7 +16,10 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
|
+
spec.required_ruby_version = "~> 2.0"
|
20
|
+
|
19
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
20
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
21
23
|
spec.add_development_dependency "mspec", "~> 1.5"
|
24
|
+
spec.add_development_dependency "rubysl-prettyprint", "~> 2.0"
|
22
25
|
end
|
metadata
CHANGED
@@ -1,57 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubysl-thread
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.2
|
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-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
16
|
- - ~>
|
18
17
|
- !ruby/object:Gem::Version
|
19
18
|
version: '1.3'
|
20
|
-
|
21
|
-
prerelease: false
|
19
|
+
name: bundler
|
22
20
|
version_requirements: !ruby/object:Gem::Requirement
|
23
21
|
requirements:
|
24
22
|
- - ~>
|
25
23
|
- !ruby/object:Gem::Version
|
26
24
|
version: '1.3'
|
25
|
+
prerelease: false
|
26
|
+
type: :development
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
30
29
|
requirements:
|
31
30
|
- - ~>
|
32
31
|
- !ruby/object:Gem::Version
|
33
32
|
version: '10.0'
|
34
|
-
|
35
|
-
prerelease: false
|
33
|
+
name: rake
|
36
34
|
version_requirements: !ruby/object:Gem::Requirement
|
37
35
|
requirements:
|
38
36
|
- - ~>
|
39
37
|
- !ruby/object:Gem::Version
|
40
38
|
version: '10.0'
|
39
|
+
prerelease: false
|
40
|
+
type: :development
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: mspec
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
44
43
|
requirements:
|
45
44
|
- - ~>
|
46
45
|
- !ruby/object:Gem::Version
|
47
46
|
version: '1.5'
|
48
|
-
|
49
|
-
prerelease: false
|
47
|
+
name: mspec
|
50
48
|
version_requirements: !ruby/object:Gem::Requirement
|
51
49
|
requirements:
|
52
50
|
- - ~>
|
53
51
|
- !ruby/object:Gem::Version
|
54
52
|
version: '1.5'
|
53
|
+
prerelease: false
|
54
|
+
type: :development
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '2.0'
|
61
|
+
name: rubysl-prettyprint
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ~>
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '2.0'
|
67
|
+
prerelease: false
|
68
|
+
type: :development
|
55
69
|
description: Support classes for working with threads.
|
56
70
|
email:
|
57
71
|
- brixen@gmail.com
|
@@ -81,19 +95,21 @@ require_paths:
|
|
81
95
|
- lib
|
82
96
|
required_ruby_version: !ruby/object:Gem::Requirement
|
83
97
|
requirements:
|
84
|
-
- -
|
98
|
+
- - ~>
|
85
99
|
- !ruby/object:Gem::Version
|
86
|
-
version: '0'
|
100
|
+
version: '2.0'
|
87
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
102
|
requirements:
|
89
|
-
- - '>='
|
103
|
+
- - ! '>='
|
90
104
|
- !ruby/object:Gem::Version
|
91
|
-
version:
|
105
|
+
version: !binary |-
|
106
|
+
MA==
|
92
107
|
requirements: []
|
93
108
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.0.
|
109
|
+
rubygems_version: 2.0.6
|
95
110
|
signing_key:
|
96
111
|
specification_version: 4
|
97
112
|
summary: Support classes for working with threads.
|
98
113
|
test_files:
|
99
114
|
- spec/exclusive_spec.rb
|
115
|
+
has_rdoc:
|