I'm making a service in C#.
I have the functions:
onStart();
copy();
onStop();
I was running copy()
inside the onStart()
function. But it was making the service status be set to starting forever, since the copy()
function is a loop that runs infinitely (with a Thread.Sleep()
inside), making the service unstoppable, unless I finish the proccess in Task Manager.
So, question is:
How can I get copy()
to run at the end of onStart()
and get onStart()
not to wait for the completion of copy()
?