Method: Thread::Future#cancel

Defined in:
lib/thread/future.rb

#cancelObject

Cancel the future, #value will yield a Cancel exception



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/thread/future.rb', line 78

def cancel
	return self if delivered?

	@mutex.synchronize {
		if @thread.is_a? Thread
			@thread.raise Cancel
		else
			@thread.terminate! Cancel
		end

		@exception = Cancel.new
	}

	self
end