@async
yakir12 opened this issue · comments
Ping @staticfloat!
spawning a @async hexdigest("MD5", file)
isn't spawned away, it's stuck until the process is finished. Since calculating the md5sum for large files can take a while, it would be great if asyncing these commands would work as expected.
Thanks a lot!
This is not what @async
is for. It does not run things in background.
What @yuyichao is trying to say, is that unless you are using a multithreading version of Julia (still experimental, and not the default) there is only one "thread" of computation within Julia. The @async
macro will create what is called a "coroutine", but this coroutine does not run at the same time as your other code; they just take turns running and when one starts waiting around for something (e.g. by calling sleep()
and waiting a certain number of milliseconds, or by calling read()
and by waiting for the OS to read in a file, etc...) the other will start running.
OK, Thanks. I'll try to see if I can rearrange my code to comply with this scheme. I think I could make this work since most of what the program is doing is wait on input from the user - at which point the Task could switch to md5suming.
Thanks again!