lib/thread/delay.rb in thread-0.1.0 vs lib/thread/delay.rb in thread-0.1.1

- old
+ new

@@ -48,14 +48,14 @@ # cached result, otherwise execute the block and return the value. # # In case the block raises an exception, it will be raised, the exception is # cached and will be raised every time you access the value. def value - raise @exception if exception? + @mutex.synchronize { + raise @exception if instance_variable_defined? :@exception - return @value if realized? + return @value if instance_variable_defined? :@value - @mutex.synchronize { begin @value = @block.call rescue Exception => e @exception = e