With the information @j2emanue provided, it seems that without the first yield()
, the parent job by default would be marked the higher priority than the child job. Your code was not going to run into the child block as it should. It kept running to child.cancel()
and so on. That was why you get message "Parent is not cancelled"
. And you never got the message "Child is cancelled"
. In contrary you leave yield()
there, it would mark the child job to run with higher priority than the parent job. So you get the message "Child is cancelled"
before "Parent is not cancelled"
. Correct me if I give any wrong explaination.