@@ -135,6 +135,18 @@ function remotecall_pool(rc_f, f, pool::AbstractWorkerPool, args...; kwargs...)
135135 end
136136end
137137
138+ function remotecall_pool (rc_f, f, pool:: CachingPool , args... ; kwargs... )
139+ worker = take! (pool)
140+ f_ref = get (pool. map_obj2ref, (worker, f), (f, RemoteChannel (worker)))
141+ isa (f_ref, Tuple) && (pool. map_obj2ref[(worker, f)] = f_ref[2 ]) # Add to tracker
142+
143+ try
144+ rc_f (exec_from_cache, worker, f_ref, args... ; kwargs... )
145+ finally
146+ put! (pool, worker)
147+ end
148+ end
149+
138150# Specialization for remotecall. We have to wait for the Future it returns
139151# before putting the worker back in the pool.
140152function remotecall_pool (rc_f:: typeof (remotecall), f, pool:: AbstractWorkerPool , args... ; kwargs... )
@@ -388,15 +400,3 @@ function exec_from_cache(f_ref::Tuple{Function, RemoteChannel}, args...; kwargs.
388400 put! (f_ref[2 ], f_ref[1 ]) # Cache locally
389401 f_ref[1 ](args... ; kwargs... )
390402end
391-
392- function remotecall_pool (rc_f, f, pool:: CachingPool , args... ; kwargs... )
393- worker = take! (pool)
394- f_ref = get (pool. map_obj2ref, (worker, f), (f, RemoteChannel (worker)))
395- isa (f_ref, Tuple) && (pool. map_obj2ref[(worker, f)] = f_ref[2 ]) # Add to tracker
396-
397- try
398- rc_f (exec_from_cache, worker, f_ref, args... ; kwargs... )
399- finally
400- put! (pool, worker)
401- end
402- end
0 commit comments