servolux 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/Rakefile +1 -0
- data/lib/servolux/threaded.rb +6 -9
- data/lib/servolux.rb +1 -1
- data/spec/threaded_spec.rb +5 -5
- metadata +1 -2
- data/.gitignore +0 -17
data/History.txt
CHANGED
data/Rakefile
CHANGED
data/lib/servolux/threaded.rb
CHANGED
@@ -61,20 +61,19 @@ module Servolux::Threaded
|
|
61
61
|
end
|
62
62
|
|
63
63
|
# Stop the activity thread. If already stopped this method will return
|
64
|
-
# without taking any action.
|
65
|
-
# the activity thread has died or until _limit_ seconds have passed.
|
64
|
+
# without taking any action.
|
66
65
|
#
|
67
66
|
# If the including class defines a 'before_stopping' method, it will be
|
68
67
|
# called before the thread is stopped. Likewise, if the including class
|
69
68
|
# defines an 'after_stopping' method, it will be called after the thread
|
70
69
|
# has stopped.
|
71
70
|
#
|
72
|
-
def stop
|
71
|
+
def stop
|
73
72
|
return self unless _activity_thread.running?
|
74
73
|
logger.debug "Stopping"
|
75
74
|
|
76
75
|
before_stopping if self.respond_to?(:before_stopping)
|
77
|
-
@_activity_thread.stop
|
76
|
+
@_activity_thread.stop
|
78
77
|
after_stopping if self.respond_to?(:after_stopping)
|
79
78
|
self
|
80
79
|
end
|
@@ -201,10 +200,10 @@ module Servolux::Threaded
|
|
201
200
|
# :stopdoc:
|
202
201
|
|
203
202
|
def _activity_thread
|
204
|
-
@_activity_thread ||= ::Servolux::Threaded::ThreadContainer.new(
|
203
|
+
@_activity_thread ||= ::Servolux::Threaded::ThreadContainer.new(60, 0, nil, false);
|
205
204
|
end
|
206
205
|
|
207
|
-
ThreadContainer = Struct.new( :
|
206
|
+
ThreadContainer = Struct.new( :interval, :iterations, :maximum_iterations, :continue_on_error, :thread, :running ) {
|
208
207
|
def start( threaded )
|
209
208
|
self.running = true
|
210
209
|
self.iterations = 0
|
@@ -212,11 +211,9 @@ module Servolux::Threaded
|
|
212
211
|
Thread.pass
|
213
212
|
end
|
214
213
|
|
215
|
-
def stop
|
214
|
+
def stop
|
216
215
|
self.running = false
|
217
216
|
thread.wakeup
|
218
|
-
join limit
|
219
|
-
self.thread = nil
|
220
217
|
end
|
221
218
|
|
222
219
|
def run( threaded )
|
data/lib/servolux.rb
CHANGED
data/spec/threaded_spec.rb
CHANGED
@@ -20,13 +20,13 @@ describe Servolux::Threaded do
|
|
20
20
|
|
21
21
|
obj = klass.new
|
22
22
|
obj.interval = 0
|
23
|
-
obj.running?.should
|
23
|
+
obj.running?.should be_nil
|
24
24
|
|
25
25
|
obj.start
|
26
26
|
obj.running?.should be_true
|
27
27
|
obj.pass
|
28
28
|
|
29
|
-
obj.stop(2)
|
29
|
+
obj.stop.join(2)
|
30
30
|
obj.running?.should be_false
|
31
31
|
end
|
32
32
|
|
@@ -46,7 +46,7 @@ describe Servolux::Threaded do
|
|
46
46
|
obj.stopped.should be_false
|
47
47
|
obj.pass
|
48
48
|
|
49
|
-
obj.stop(2)
|
49
|
+
obj.stop.join(2)
|
50
50
|
obj.stopped.should be_true
|
51
51
|
end
|
52
52
|
|
@@ -68,7 +68,7 @@ describe Servolux::Threaded do
|
|
68
68
|
obj.ary.should == [1,2]
|
69
69
|
obj.pass
|
70
70
|
|
71
|
-
obj.stop(2)
|
71
|
+
obj.stop.join(2)
|
72
72
|
obj.ary.should == [1,2,3,4]
|
73
73
|
end
|
74
74
|
|
@@ -111,7 +111,7 @@ describe Servolux::Threaded do
|
|
111
111
|
@log_output.readline
|
112
112
|
@log_output.readline.chomp.should == "ERROR Object : <RuntimeError> ni"
|
113
113
|
|
114
|
-
obj.stop(2)
|
114
|
+
obj.stop.join(2)
|
115
115
|
obj.running?.should be_false
|
116
116
|
end
|
117
117
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: servolux
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Pease
|
@@ -66,7 +66,6 @@ extra_rdoc_files:
|
|
66
66
|
- History.txt
|
67
67
|
- README.rdoc
|
68
68
|
files:
|
69
|
-
- .gitignore
|
70
69
|
- History.txt
|
71
70
|
- README.rdoc
|
72
71
|
- Rakefile
|
data/.gitignore
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# The list of files that should be ignored by Mr Bones.
|
2
|
-
# Lines that start with '#' are comments.
|
3
|
-
#
|
4
|
-
# A .gitignore file can be used instead by setting it as the ignore
|
5
|
-
# file in your Rakefile:
|
6
|
-
#
|
7
|
-
# PROJ.ignore_file = '.gitignore'
|
8
|
-
#
|
9
|
-
# For a project with a C extension, the following would be a good set of
|
10
|
-
# exclude patterns (uncomment them if you want to use them):
|
11
|
-
# *.[oa]
|
12
|
-
*~
|
13
|
-
*.sw[op]
|
14
|
-
announcement.txt
|
15
|
-
coverage
|
16
|
-
doc
|
17
|
-
pkg
|