I started using the following code pattern:
my_tasks = []
for i in my_inputs
task = @spawn my_function(i)
push!(my_tasks, task)
end
while !all(istaskdone.(my_tasks))
sleep(1)
println("some progress message about the tasks")
end
However, if I spawn a lot of tasks, the main thread does not resume from the sleep
call, instead it waits for most of the other spawned tasks to finish.
What would be the “proper” way to ensure that the main thread is of sufficiently high priority to continue executing no matter how many tasks were spawned.