For the third time: just read the manual. Of course it's terminated because wait always terminates a function.

"Wait temporarily terminates the function (like return), stores its local variables and the my and you pointers, stores the function state in an internal list (Scheduler List), and returns to the calling function (if any)."


A computer does not read your mind - it just does what you tell it to do.