@@ -498,8 +498,6 @@ def touch
498
498
self
499
499
end
500
500
501
- alias_method :needed , :touch
502
-
503
501
# @!macro [new] promises.touches
504
502
# Calls {AbstractEventFuture#touch}.
505
503
@@ -512,7 +510,6 @@ def touch
512
510
# @return [Future, true, false] self implies timeout was not used, true implies timeout was used
513
511
# and it was completed, false implies it was not completed within timeout.
514
512
def wait ( timeout = nil )
515
- touch
516
513
result = wait_until_complete ( timeout )
517
514
timeout ? result : self
518
515
end
@@ -657,7 +654,7 @@ def promise
657
654
658
655
# For inspection.
659
656
# @!visibility private
660
- def touched
657
+ def touched?
661
658
@Touched . value
662
659
end
663
660
@@ -687,6 +684,8 @@ def add_callback(method, *args)
687
684
def wait_until_complete ( timeout )
688
685
return true if completed?
689
686
687
+ touch
688
+
690
689
@Lock . synchronize do
691
690
begin
692
691
unless completed?
@@ -838,7 +837,6 @@ def failed?(state = internal_state)
838
837
# @!macro promises.param.timeout
839
838
# @return [Object, nil] the value of the Future when successful, nil on timeout or failure.
840
839
def value ( timeout = nil )
841
- touch
842
840
internal_state . value if wait_until_complete timeout
843
841
end
844
842
@@ -850,7 +848,6 @@ def value(timeout = nil)
850
848
# @!macro promises.param.timeout
851
849
# @return [Exception, nil] nil on timeout or success.
852
850
def reason ( timeout = nil )
853
- touch
854
851
internal_state . reason if wait_until_complete timeout
855
852
end
856
853
@@ -862,14 +859,12 @@ def reason(timeout = nil)
862
859
# @return [Array(Boolean, Object, Exception), nil] triplet of success?, value, reason, or nil
863
860
# on timeout.
864
861
def result ( timeout = nil )
865
- touch
866
862
internal_state . result if wait_until_complete timeout
867
863
end
868
864
869
865
# @!macro promises.method.wait
870
866
# @raise [Exception] {#reason} on failure
871
867
def wait! ( timeout = nil )
872
- touch
873
868
result = wait_until_complete! ( timeout )
874
869
timeout ? result : self
875
870
end
@@ -878,7 +873,6 @@ def wait!(timeout = nil)
878
873
# @return [Object, nil] the value of the Future when successful, nil on timeout.
879
874
# @raise [Exception] {#reason} on failure
880
875
def value! ( timeout = nil )
881
- touch
882
876
internal_state . value if wait_until_complete! timeout
883
877
end
884
878
0 commit comments