herpes 0.0.2.7 → 0.0.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/herpes.rb +18 -3
  2. data/lib/herpes/version.rb +1 -1
  3. metadata +5 -5
@@ -78,14 +78,13 @@ class Herpes
78
78
  new.load(*path)
79
79
  end
80
80
 
81
- include Awakenable
82
81
  extend Forwardable
83
82
 
84
83
  attr_reader :modules
85
84
  def_delegators :@pool, :do, :process
86
85
 
87
86
  def initialize
88
- @pool = ThreadPool.new
87
+ @pool = ThreadPool.new(5)
89
88
  @modules = []
90
89
 
91
90
  @before = Hash.new { |h, k| h[k] = [] }
@@ -294,10 +293,26 @@ class Herpes
294
293
 
295
294
  wake_up
296
295
 
297
- @pool.kill
296
+ @pool.shutdown
298
297
  end
299
298
 
300
299
  def stop
301
300
  stop!
302
301
  end
302
+
303
+ def sleep (time = nil)
304
+ @awakenable ||= IO.pipe
305
+
306
+ begin
307
+ @awakenable.first.read_nonblock 2048
308
+ rescue Errno::EAGAIN; end
309
+
310
+ IO.select([@awakenable.first], nil, nil, time)
311
+ end
312
+
313
+ def wake_up
314
+ @awakenable ||= IO.pipe
315
+
316
+ @awakenable.last.write 'x'
317
+ end
303
318
  end
@@ -10,6 +10,6 @@
10
10
 
11
11
  class Herpes
12
12
  def self.version
13
- '0.0.2.7'
13
+ '0.0.2.8'
14
14
  end
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: herpes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2.7
4
+ version: 0.0.2.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-21 00:00:00.000000000 Z
12
+ date: 2012-03-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: threadpool
16
- requirement: &16037080 !ruby/object:Gem::Requirement
16
+ requirement: &21483200 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *16037080
24
+ version_requirements: *21483200
25
25
  description:
26
26
  email: meh@paranoici.org
27
27
  executables:
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
64
  version: '0'
65
65
  requirements: []
66
66
  rubyforge_project:
67
- rubygems_version: 1.8.15
67
+ rubygems_version: 1.8.11
68
68
  signing_key:
69
69
  specification_version: 3
70
70
  summary: A event/notification handler.