|
|
|
|
|
by Charon77
789 days ago
|
|
In case you're thinking of using this in production (please don't) Keep in mind that there's a general limitation in most sleep implementation across languages. sleep(x) typically waits for _at least x amount of time/second/millisecond Therefore, there's a possibility that sleep(2) finishes after sleep(1) because the scheduler is lazy. The risk gets higher the closer the wait interval is to the scheduling rate (timer resolution). So if you try running this with small amount of time, maybe in microseconds or nanoseconds, and you got items in the wrong order, this would be one explanation. |
|