In this particular example of drift, is there only one task?
task_num == 1
is true? Or what is, exactly, going on in your test? Are you enclosing the disclosed code inside of yet another while forever
kind of loop? If not, then what? And have you ever heard of a delta-queue
concept -- it is exactly what would be appropriate here. (The concept was created by Dr. Comer in the early 1980s. I sat on a committee with him for a short period of time. I write operating systems as part of what I do, professionally.)