asynchronic 4.0.1 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1927d93fad4703789a566429a5e31767e332ca9f17cbe94db92f899587398a38
4
- data.tar.gz: 64a6f3c8fc8d9248166ba6b1fc0dcc4f9d51a6229f3a2f3d4b99b645dd92059f
3
+ metadata.gz: 07ec97c040ebf5305b647eb5577c5bdb273d5b374903382fb8d0269aa50d9b2c
4
+ data.tar.gz: b5b53fa01eb3fa68327959cc65dc48738b56625c3ae355ba03232fddec6df590
5
5
  SHA512:
6
- metadata.gz: '0207949f35f7e91d8b5506d469e85f023071a5bbfbc17631fbbf4f5da76e22f2224d4bc08ecf347fe0b34f06e08d063c3db1e1b7d0c81a6ff164c4d9e1ba21a7'
7
- data.tar.gz: 17f48dc8a1bb5aed62d28aa5a22d1c6f6271fa5b39a0032fce098148c22185a88803e741760b8aa8b35a3b765d5675136b9808b62e996bd0138d8cac5d866b2a
6
+ metadata.gz: 9590b7f7c7d6a41a340d3cb4a9f9e5960f3b0b7424b804d494abaae97889b8855a8e176815c6d8f93bc89bddb0bb264d31a94e2436f67ba8954ca27d58a69520
7
+ data.tar.gz: 3335e3a9732b1b9cd3f2513fcdffe42a1d0c2644290dd1e2aa369d2d2f11dd4688e911e4463b29d8bcbd98c04cfcf12c433a1d84c633f998347bcd36fc98ba27
@@ -15,7 +15,7 @@ module Asynchronic
15
15
  def initialize
16
16
  @hash = {}
17
17
  @mutex = Mutex.new
18
- @keys_mutex = Hash.new { |h,k| h[k] = Mutex.new }
18
+ @keys_mutex = {}
19
19
  self.class.connections[object_id] = self
20
20
  end
21
21
 
@@ -41,6 +41,9 @@ module Asynchronic
41
41
  end
42
42
 
43
43
  def synchronize(key, &block)
44
+ mutex.synchronize do
45
+ keys_mutex[key] ||= Mutex.new
46
+ end
44
47
  keys_mutex[key].synchronize(&block)
45
48
  end
46
49
 
@@ -51,7 +51,7 @@ module Asynchronic
51
51
  job = process.job
52
52
  block = engine.stubs[process.type]
53
53
  process.define_singleton_method :job do
54
- MockJob.new job, process, &block
54
+ MockJob.new job, process, block
55
55
  end
56
56
  end
57
57
 
@@ -67,7 +67,7 @@ module Asynchronic
67
67
 
68
68
  class MockJob < TransparentProxy
69
69
 
70
- def initialize(job, process, &block)
70
+ def initialize(job, process, block)
71
71
  super job
72
72
  @process = process
73
73
  @block = block
@@ -1,3 +1,3 @@
1
1
  module Asynchronic
2
- VERSION = '4.0.1'
2
+ VERSION = '4.0.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asynchronic
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Naiman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-06 00:00:00.000000000 Z
11
+ date: 2021-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ost