futuroscope 0.0.8 → 0.0.9

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: eae2202922ccb093d05befba1746a250c921550c
4
- data.tar.gz: bf6928229dd63743c61b14c42691a12840822f16
3
+ metadata.gz: 4e066ddbe361ebf3572172f07fbb8a8f01aa19ad
4
+ data.tar.gz: d087e61fd2f458e3ad9b4013f5d2fbdd68de6b8e
5
5
  SHA512:
6
- metadata.gz: a191c018ba8ad53f7340be9549fecbeb4517d561e207ccb67fdd157b5fef8cafdf70859570be714694fa83982a2af391d6a8b0cbbbc1c13dd2d69c93183839a8
7
- data.tar.gz: 49da8118b07fa7876908672592cf28554f8d109c2ee6f9ca887d476b8c7bc5d85522974377d15ae2732f39afcf36d75248e16ab1ae39c4e8a6219704107b91cd
6
+ metadata.gz: 1691e432210c6caa0275a4961972fef07de521909d4f7eb6d105bcfbc2d652d4f63e99e8cb5290d59efb9cde2fe31b8ec794c98c26694a9808f485cd1a2052a3
7
+ data.tar.gz: bc7302b1ebe5f7301fb18b5710ad2db5dd8d9c8e3f6d14034dfe57a4b8d1516b408e0e5bba00c49988d039c36de1fbe8a7ca376eff5061e98adeff1905043e18
@@ -5,7 +5,6 @@ module Futuroscope
5
5
  # and will return it instantly if the thread's execution already finished.
6
6
  #
7
7
  class Future
8
- attr_writer :future_value
9
8
  extend Forwardable
10
9
 
11
10
  # Initializes a future with a block and starts its execution.
@@ -32,12 +31,14 @@ module Futuroscope
32
31
  end
33
32
 
34
33
  def run_future
35
- begin
36
- self.future_value = @block.call
37
- rescue Exception => e
38
- @exception = e
34
+ @mutex.synchronize do
35
+ begin
36
+ @future_value = @block.call
37
+ rescue Exception => e
38
+ @exception = e
39
+ end
40
+ @condition.signal
39
41
  end
40
- @condition.signal
41
42
  end
42
43
 
43
44
  # Semipublic: Returns the future's value. Will wait for the future to be
@@ -66,11 +67,5 @@ module Futuroscope
66
67
  def respond_to_missing?(method, include_private = false)
67
68
  future_value.respond_to?(method, include_private)
68
69
  end
69
-
70
- def future_value=(value)
71
- @mutex.synchronize do
72
- @future_value = value
73
- end
74
- end
75
70
  end
76
71
  end
@@ -1,3 +1,3 @@
1
1
  module Futuroscope
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: futuroscope
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy