I’d say the printing of the task is misleading here. (runnable) does not mean “the user can schedule it.”
Also, I think it’s very tricky to use yield for a task that is already started. In particular, the code in the OP is not correct. If you want to know when yield can be called on the task that is already started, have a look at RFC: Low-level API for `schedule` and `wait` by tkf · Pull Request #41270 · JuliaLang/julia · GitHub which discusses when schedule can be used for the task that is already started. Using yield is even more strict since you have to know that the context switch has been completed. I think this requires knowing the worker thread that executed the said task and then that the worker thread is now executing another task.