Can anyone tell me what functions are better to use in C++ other than Sleep? I’ve heard of Pause and milSleep but I’m not sure if there is a better way to go.
I don't think there's anything in the standard lib, so whatever function you use depends on what lib you're using. Other than that, they're pretty much all the same.
Sounds good, I read around some other forums and other people were saying that “Sleep isn’t safe to use”. I’m not sure why but I thought I’d ask and get some more opinions on it.
I guess it depends on what you're doing. AFAIK, Sleep does exactly what it claims to do.
EDIT:
After googling it looks like the "unsafe" stuff spawns from multithreading issues. I haven't really read them in detail, but I don't see why it would be bad in those situations. I'll have to read more about it after work.
What kind of situation do you need Sleep() for? Will this be in a multithreading environment?
Basically: dont' use Sleep to yeild CPU time to other threads. That's not what it's for.
That's not what it says. For starters, the very purpose of Sleep() is to yield CPU time.
The link talks about a rather specific situation. It talks about trying to yield CPU from a highest priority thread using Sleep(0). It doesn't apply if the thread is not the one with the highest priority or if you sleep with Sleep(x>0).