0

How to temporally interupt while(true) loop to execute another function?

https://www.sololearn.com/compiler-playground/cRRIxDdgXdZd I have terminal based program, so its running in while(true) loop. Every 5 minutes i need to interupt any procces and ask user to answer question. If answer is right, user is being returned back to work. If answer is wrong user is being prompted to log in. I tried Timer and Thread, but nothing worked. Best i`ve got is asking a question, but responce is being read into current working menu, so procces is not being interupted.

16th Apr 2023, 7:06 PM
Artur
Artur - avatar
1 Respuesta
+ 3
Could you put in 1 or more check/s for the elapsed timer in your while loop? https://josipmisko.com/posts/c-sharp-timer This might help you.
16th Apr 2023, 7:54 PM
Ausgrindtube
Ausgrindtube - avatar