libuv 2.0.2 → 2.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: efca251c5022c8b1930338e419d3b18768aefd24
4
- data.tar.gz: a8083cd695fbed0357daf6fb5bfa143d8117b3e2
3
+ metadata.gz: c8d3076693c01bb76953ce8b883c5978bb4169a8
4
+ data.tar.gz: e5410efdde18367e7b78c3efdcd8f1db8a619e88
5
5
  SHA512:
6
- metadata.gz: 90c1818cc42e10b76edb107f8a1bbb8582c511dafd12a1ed9c4b883e617146af01922eac241b0a3c012d9a449193c9177bbf401dfae88ce901ade0963f196c83
7
- data.tar.gz: 8b4bd90f4adeddc3c94fe0eeecfabe27b569bd327c7945d4193f8108cc9720655a5b8d94a9405ff243c789f3c80318a0f88919ac3c322727e0b15d762b96d427
6
+ metadata.gz: 90c9bee7837dcef7d431ad174f0e096938ec8866261d6fab695146930cbe9e8e503df4ae82ae9e0809c4583cd56cb0dbac8fa36e6565f1edb647820d93028e6d
7
+ data.tar.gz: 0efd4cb5ae7ce63058fc76ed1e2a00ce842f2643df776b38a171aa1ecad3cbfefbb3b4bc40c7c1fe68946423065e5e9e0ca58af96b4e7ad91ef045d9040d70f9
@@ -1,5 +1,4 @@
1
1
  require 'thread_safe'
2
- require 'set'
3
2
 
4
3
  module Libuv
5
4
  module Listener
@@ -26,11 +25,12 @@ module Libuv
26
25
  def inherited(subclass)
27
26
  subclass.instance_variable_set(:@callback_funcs, {}.merge(@callback_funcs))
28
27
  subclass.instance_variable_set(:@callback_lookup, @callback_lookup)
28
+ subclass.instance_variable_set(:@callback_lock, @callback_lock)
29
29
  end
30
30
 
31
31
 
32
32
  # Provide accessor methods to the class level instance variables
33
- attr_reader :callback_lookup, :callback_funcs
33
+ attr_reader :callback_lookup, :callback_funcs, :callback_lock
34
34
 
35
35
 
36
36
  # This function is used to work out the instance the callback is for
@@ -42,6 +42,7 @@ module Libuv
42
42
  def self.included(base)
43
43
  base.instance_variable_set(:@callback_funcs, {})
44
44
  base.instance_variable_set(:@callback_lookup, ThreadSafe::Cache.new)
45
+ base.instance_variable_set(:@callback_lock, Mutex.new)
45
46
  base.extend(ClassMethods)
46
47
  end
47
48
 
@@ -49,12 +50,18 @@ module Libuv
49
50
 
50
51
  def callback(name, instance_id = @instance_id)
51
52
  klass = self.class
52
- klass.callback_lookup[instance_id] ||= self
53
+ klass.callback_lock.synchronize do
54
+ klass.callback_lookup[instance_id] = self
55
+ end
53
56
  klass.callback_funcs[name]
54
57
  end
55
58
 
56
59
  def cleanup_callbacks(instance_id = @instance_id)
57
- self.class.callback_lookup.delete(instance_id)
60
+ klass = self.class
61
+ klass.callback_lock.synchronize do
62
+ inst = klass.callback_lookup[instance_id]
63
+ klass.callback_lookup.delete(instance_id) if inst == self
64
+ end
58
65
  end
59
66
  end
60
67
  end
data/lib/libuv/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Libuv
2
- VERSION = '2.0.2'
2
+ VERSION = '2.0.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libuv
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bulat Shakirzyanov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-08-19 00:00:00.000000000 Z
12
+ date: 2015-08-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi