Skip to content

Commit 53e7a9a

Browse files
committed
Documentaion
1 parent 1fd2965 commit 53e7a9a

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

lib/concurrent/edge/future.rb

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@
66

77
# @note different name just not to collide for now
88
module Concurrent
9+
10+
# Provides edge features, which will be added to or replace features in main gem.
11+
#
12+
# Contains new unified implementation of Futures and Promises which combines Features of previous `Future`,
13+
# `Promise`, `IVar`, `Probe`, `dataflow`, `Delay`, `TimerTask` into single framework. It uses extensively
14+
# new synchronization layer to make all the paths lock-free with exception of blocking threads on `#wait`.
15+
# It offers better performance and does not block threads (exception being #wait and similar methods where it's
16+
# intended).
17+
#
18+
# ## Examples
19+
# {include:file:examples/edge_futures.out.rb}.
920
module Edge
1021

1122
module FutureShortcuts
@@ -116,6 +127,7 @@ def wait(timeout = nil)
116127
self
117128
end
118129

130+
# @!visibility private
119131
def touch
120132
# distribute touch to promise only once
121133
@Promise.touch if @Touched.make_true
@@ -172,7 +184,7 @@ def inspect
172184
"#{to_s[0..-2]} blocks:[#{blocks.map(&:to_s).join(', ')}]>"
173185
end
174186

175-
# @api private
187+
# @!visibility private
176188
def complete(raise = true)
177189
if complete_state
178190
# go to synchronized block only if there were waiting threads
@@ -185,7 +197,7 @@ def complete(raise = true)
185197
self
186198
end
187199

188-
# @api private
200+
# @!visibility private
189201
# just for inspection
190202
# @return [Array<AbstractPromise>]
191203
def blocks
@@ -194,13 +206,13 @@ def blocks
194206
end
195207
end
196208

197-
# @api private
209+
# @!visibility private
198210
# just for inspection
199211
def callbacks
200212
@Callbacks.each.to_a
201213
end
202214

203-
# @api private
215+
# @!visibility private
204216
def add_callback(method, *args)
205217
if completed?
206218
call_callback method, *args
@@ -211,12 +223,14 @@ def add_callback(method, *args)
211223
self
212224
end
213225

214-
# @api private, only for inspection
226+
# @!visibility private
227+
# only for inspection
215228
def promise
216229
@Promise
217230
end
218231

219-
# @api private, only for inspection
232+
# @!visibility private
233+
# only for inspection
220234
def touched
221235
@Touched.value
222236
end
@@ -407,12 +421,12 @@ def on_failure!(&callback)
407421
add_callback :pr_callback_on_failure, callback
408422
end
409423

410-
# @api private
424+
# @!visibility private
411425
def apply_value(value, block)
412426
block.call value
413427
end
414428

415-
# @api private
429+
# @!visibility private
416430
def complete(success, value, reason, raise = true)
417431
if complete_state success, value, reason
418432
@Waiters.clear
@@ -499,15 +513,13 @@ def pr_async_callback_on_completion(success, value, reason, executor, callback)
499513

500514
class CompletableEvent < Event
501515
# Complete the event
502-
# @api public
503516
def complete(raise = true)
504517
super raise
505518
end
506519
end
507520

508521
class CompletableFuture < Future
509522
# Complete the future
510-
# @api public
511523
def complete(success, value, reason, raise = true)
512524
super success, value, reason, raise
513525
end

0 commit comments

Comments
 (0)