Use that link to read to the forum thread again. How did he really solve the problem, even though nested interrupts were discussed? He revised the task scheduler, by yanking that STOP instruction out of an interrupt handler.
OK, so calling a function to do a WAIT is not the same thing as an interrrupt handler. However, think about it. The system is idle, so the scheduler calls the function. The function is entered, and the context of the task scheduler is placed onto the stack. Now you WAIT. When an interrupt brings you out of the wait state, the function exits, and the context of the task scheduler is restored. That works fine as long as you can guarantee that the next interrupt is not going to occur until after the function exits. If you happen to get two interrupts in a row, where will the program be?
1) The function exit code is unreeling the stack to restore the task scheduler context, and now the interrupt handler butts in. The stack might get pranged.
2) Or, the function has not exited, and the interrupt uses the context of... what? The function? Your handlers might be relying on some portion of the task scheduler's context to do things (access buffers?) and it simply is not there.
Short answer is: take the WAIT out the function call.
---Tom