i have some operation that sometimes i want to stop in the middle:
bool contine;
foreach (var item in this)
{
if (contine)
{
// do my stuss
}
}
The issue here that inside this foreach
sometimes i need specific delay time so i am using Thread.Sleep
.
So when i stop my operation in case i am still inside this Thread.Sleep
my application is waiting until this Thread.Sleep
end and only than stop my operation so can i exit from Thread.Sleep
in the middle ?
Update
The reason i need specific sleep is because i am play packets and between every packets there is a Time stamp
so this is why i need this sleep.