@@ -13,10 +13,12 @@ const client_refs = WeakKeyDict{Any, Nothing}() # used as a WeakKeySet
13
13
abstract type AbstractRemoteRef end
14
14
15
15
"""
16
- Future(pid::Integer=myid() )
16
+ Future(w::Int, rrid::RRID, v::Union{Some, Nothing}=nothing )
17
17
18
- Create a `Future` on process `pid`.
19
- The default `pid` is the current process.
18
+ A `Future` is a placeholder for a single computation
19
+ of unknown termination status and time.
20
+ For multiple potential computations, see `RemoteChannel`.
21
+ See `remoteref_id` for identifying an `AbstractRemoteRef`.
20
22
"""
21
23
mutable struct Future <: AbstractRemoteRef
22
24
where :: Int
@@ -98,9 +100,15 @@ function finalize_ref(r::AbstractRemoteRef)
98
100
nothing
99
101
end
100
102
103
+ """
104
+ Future(pid::Integer=myid())
105
+
106
+ Create a `Future` on process `pid`.
107
+ The default `pid` is the current process.
108
+ """
109
+ Future (pid:: Integer = myid ()) = Future (pid, RRID ())
101
110
Future (w:: LocalProcess ) = Future (w. id)
102
111
Future (w:: Worker ) = Future (w. id)
103
- Future (pid:: Integer = myid ()) = Future (pid, RRID ())
104
112
105
113
RemoteChannel (pid:: Integer = myid ()) = RemoteChannel {Channel{Any}} (pid, RRID ())
106
114
@@ -177,9 +185,12 @@ If the argument `Future` is owned by a different node, this call will block to w
177
185
It is recommended to wait for `rr` in a separate task instead
178
186
or to use a local [`Channel`](@ref) as a proxy:
179
187
180
- c = Channel(1)
181
- @async put!(c, remotecall_fetch(long_computation, p))
182
- isready(c) # will not block
188
+ ```julia
189
+ p = 1
190
+ f = Future(p)
191
+ @async put!(f, remotecall_fetch(long_computation, p))
192
+ isready(f) # will not block
193
+ ```
183
194
"""
184
195
function isready (rr:: Future )
185
196
rr. v === nothing || return true
@@ -232,7 +243,7 @@ function del_clients(pairs::Vector)
232
243
end
233
244
end
234
245
235
- any_gc_flag = Condition ()
246
+ const any_gc_flag = Condition ()
236
247
function start_gc_msgs_task ()
237
248
@async while true
238
249
wait (any_gc_flag)
0 commit comments