3 ms·
"sleep(1)" means "sleep 16ms" You sure? According to e.g. the article it results in "sleep anywhere between 1 and 16mSec". But this illustrates part of the pro
by stinos 6y ago
"sleep(1)" means "sleep 16ms"
You sure? According to e.g. the article it results in "sleep anywhere between 1 and 16mSec". But this illustrates part of the problem here: arguably problematic use of Sleep() where other solutions are more appropriate and people not reading the documentation and/or not realizing what it means.
- gambiting 6y agoWell, yes, I suppose technically that is correct. In our use case the thread would wake up, check if there was any work to do, if not then sleep(1). If you're doing it continuously(there is nothing to do) the thread would be sleeping for 16ms pretty much exactly every time - which meant that any time any work came in it wouldn't be picked up immediately, but anywhere between 1-16ms(which was unacceptable for this use case).