Skip to content

Commit b743ec8

Browse files
authored
Merge pull request #15 from JuliaParallel/jps/no-watcher-precompile
Don't start watcher during precompile
2 parents 135f5bd + fecb70d commit b743ec8

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/DistributedNext.jl

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -132,19 +132,21 @@ include("precompile.jl")
132132
function __init__()
133133
init_parallel()
134134

135-
# Start a task to watch for the Distributed stdlib being loaded and
136-
# initialized to support multiple workers. We do this by checking if the
137-
# cluster cookie has been set, which is most likely to have been done
138-
# through Distributed.init_multi() being called by Distributed.addprocs() or
139-
# something.
140-
watcher_task = Threads.@spawn while true
141-
if _check_distributed_active()
142-
return
135+
if ccall(:jl_generating_output, Cint, ()) == 0
136+
# Start a task to watch for the Distributed stdlib being loaded and
137+
# initialized to support multiple workers. We do this by checking if the
138+
# cluster cookie has been set, which is most likely to have been done
139+
# through Distributed.init_multi() being called by Distributed.addprocs() or
140+
# something.
141+
watcher_task = Threads.@spawn while true
142+
if _check_distributed_active()
143+
return
144+
end
145+
146+
sleep(1)
143147
end
144-
145-
sleep(1)
148+
errormonitor(watcher_task)
146149
end
147-
errormonitor(watcher_task)
148150
end
149151

150152
end

0 commit comments

Comments
 (0)