Note that the tasks all run in the same thread, so if any of the tasks (or the main process) have a long running computation which does not yield, the other processes won't run. I believe that `sleep 10` falls in this category, although I'm not 100% certain.
Cheers, Kevin On Thu, Jul 17, 2014 at 1:49 PM, Tim Holy <[email protected]> wrote: > Check out the implementation of multi.jl:pmap (the part in the @sync and > @async blocks), it's a great example. > > --Tim > > On Thursday, July 17, 2014 04:23:48 PM Elliot Saba wrote: > > I was reading the docs > > < > http://julia.readthedocs.org/en/latest/manual/control-flow/#tasks-and-event > > s>, and it seems to me that it's saying I can use tasks to run multiple > > subprocesses at once. E.g., if I have some long-running subprocesses > such > > as `sleep 10`, I should be able to wrap each in a Task and use the > inherent > > wait() command that running each subprocess would entail to switch to > > another task and kick off another subprocess. Is this correct? If it > is, > > can someone provide me a quick example? I can't seem to get this to > work, > > but I've never used Tasks before so that's hardly surprising. ;) > > -E > >
