src/Visualise.jl

changeset 27
51bb83c404a4
parent 26
863711a498fe
child 34
fe9ef03a91b2
equal deleted inserted replaced
26:863711a498fe 27:51bb83c404a4
189 function initialise_visualisation(visualise; iterator=iterate_visualise) 189 function initialise_visualisation(visualise; iterator=iterate_visualise)
190 # Create visualisation 190 # Create visualisation
191 if visualise 191 if visualise
192 rc = Channel(1) 192 rc = Channel(1)
193 visproc = Threads.@spawn bg_visualise(rc) 193 visproc = Threads.@spawn bg_visualise(rc)
194 vis =rc 194 bind(rc, visproc)
195 vis = rc
195 else 196 else
196 vis = false 197 vis = false
197 visproc = nothing 198 visproc = nothing
198 end 199 end
199 200
205 206
206 function finalise_visualisation(st) 207 function finalise_visualisation(st)
207 if isa(st.vis, Channel) 208 if isa(st.vis, Channel)
208 # Tell subprocess to finish, and wait 209 # Tell subprocess to finish, and wait
209 put!(st.vis, nothing) 210 put!(st.vis, nothing)
211 close(st.vis)
210 wait(st.visproc) 212 wait(st.visproc)
211 end 213 end
212 end 214 end
213 215
214 end # Module 216 end # Module

mercurial