thread 0.2.1 → 0.2.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
  SHA1:
3
- metadata.gz: 513a028c21896bab77d841a86a9b107ee7fee6e1
4
- data.tar.gz: bec1675936f02f186c63683df4b55cc19036ddb9
3
+ metadata.gz: 9872e276bf4a9eafda05c16259f2e25d938e78f7
4
+ data.tar.gz: 2b14d91995e1ff8826e3bd1ae7c8722f4b3d60eb
5
5
  SHA512:
6
- metadata.gz: 719c2e53adb63973a2fab8d87ee7c9d1924731f5405bf47f15b463be8694ef4232c8bccec89ea089534de845389009c3f4bd0da864037c89ebefa74b1532d746
7
- data.tar.gz: 62b91fb7bb2b97a92fa5dfe55c50976b6fc641b994af293db071ae0fde4b8f6ea0fd6f39fba8948c8674488fa74a1e8b754adf472e925f2d143b46ec24ddbb1e
6
+ metadata.gz: b1241c434a0131b2de037f087c36071ceb0976444573a08d387bf7dea05673a4a2032bbf6b61aa3c3a8bfcf8b0ccb394416cab861579b4483be087603e822bd4
7
+ data.tar.gz: ed31bed39a59921df6503fbfb49f56e4ada4050b5f012a8ffabde883b215701ce91422f1644f0706a4adb61eafabec1c0aabf62c625fa583d66164f97081ad62
@@ -42,7 +42,11 @@ class Thread::Future
42
42
  def self.finalizer(thread)
43
43
  proc {
44
44
  if thread.weakref_alive?
45
- thread.raise Cancel.new
45
+ if thread.is_a? Thread
46
+ thread.raise Cancel
47
+ else
48
+ thread.terminate! Cancel
49
+ end
46
50
  end
47
51
  }
48
52
  end
@@ -75,7 +79,13 @@ class Thread::Future
75
79
  return self if delivered?
76
80
 
77
81
  @mutex.synchronize {
78
- @thread.raise Cancel.new('future cancelled')
82
+ if @thread.is_a? Thread
83
+ @thread.raise Cancel
84
+ else
85
+ @thread.terminate! Cancel
86
+ end
87
+
88
+ @exception = Cancel.new
79
89
  }
80
90
 
81
91
  self
@@ -83,7 +83,7 @@ class Thread::Pool
83
83
 
84
84
  # Raise an exception in the thread used by the task.
85
85
  def raise(exception)
86
- @thread.raise(exception)
86
+ @thread.raise(exception) if @thread
87
87
  end
88
88
 
89
89
  # Terminate the exception with an optionally given exception.
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "thread"
7
- spec.version = "0.2.1"
7
+ spec.version = "0.2.2"
8
8
  spec.authors = ["meh."]
9
9
  spec.email = ["meh@schizofreni.co"]
10
10
  spec.summary = %q{Various extensions to the base thread library.}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thread
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - meh.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-08 00:00:00.000000000 Z
11
+ date: 2015-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec