|
|
|
|
|
by weinzierl
3033 days ago
|
|
> Yes, I know, civilized people don’t use ‘sleep’, because that is a waste of CPU I'm not sure what language the example is in and don't really understand the script. That being said: In most languages sleep just is a wrapper around the system call with the same name. Again for most current and common operating systems this doesn't waste CPU cycles because it just puts your thread of process in an inactive state. Other threads or processes can use the CPU during that time. That doesn't mean calling sleep with a small argument repeatedly is a good idea because it causes two context switches per call which might be an indirect waste of CPU cycles. |
|