As my question here: Stop program when thread finished?
I have a window service and an aspx page. In aspx page, I have to start the service. This service will run a thread, after thread finish, it will stop the service. After that, my aspx page have to show result to screen.
So, I have to: Check if service running - Start service - check if services stop - Print result to screen.
Currently, my code is like:
while(true){
if(isServiceStop){
MyService.Start();
while(true){
if(isServiceStop){
Print result;
break;
}
}
break;
}
}
This way, it will skyrocket my CPU_Usage, so, I want to know if there is any other way to achieve my request