Talk:Sleep (system call)

message: Is the infinite wait loop talked about here acutally an event loop? --Abdull 15:50, 19 April 2007 (UTC)
replies: text: Yes, so I changed it. — Loadmaster 15:15, 26 May 2007 (UTC)
thread_title: Infinite loop

message: This article and Sleep mode are both stub and about the same subject. I propose a merge. --Android Mouse 17:27, 24 May 2007 (UTC)
replies: text: No, they are not. The Sleep mode article is about a stand-by power-down of a device, causing all programs to stop execution; this article is about the operating system call that causes a program/process/thread to become inactive, allowing other processes to continue execution. Two different concepts, two different articles. (I remember looking at the Sleep mode article before I created this one.) — Loadmaster 15:12, 26 May 2007 (UTC)
replies: text: I understand, but I fail to see why the system call is notable enough for its own article. The information would be better merged to the other article. We don't have a seperate article for Shutdown (a much older concept), and infact that article is over even a broader subject than both of these articles. --Android Mouse 04:23, 15 June 2007 (UTC)
thread_title: [[Sleep mode]] merge

message: Thread (computer science) says that threads can go to sleep. Is this the same (by concept) sleep as the sleep in this article? Wouldn't it then make sense to restate the first sentence as: A computer program (process, thread or task) may sleep, which places it into an inactive state for a period of time.? --Abdull (talk) 15:10, 21 November 2007 (UTC)
thread_title:  sleep and threads 

message: What's the differnce between sleep and stand by? --Marshall T. Williams (talk) 19:54, 1 January 2009 (UTC)
thread_title:  Sleep vs. Stand by 

message: Seriously, who wrote this section? It is so wrongly based on Java implementation peculiarities rather than operating system support and incorrect on almost all acounts. For example, there is no such thing as a Wait syscall under Windows at all.  — Preceding unsigned comment added by 92.192.119.211 (talk) 16:33, 26 October 2012 (UTC)
thread_title:  Low level functionality 

message: The C code is inside of a while loop, but its never explained why this is so.
If we wanted to show off the use of a sleep function, why not just have it be:
Sleep(2*1000) //Sleep for 2 seconds
Robodoggy (talk) 23:23, 30 October 2012 (UTC)
thread_title:  C code inside of a while loop. 

message: What's the relationship between "Uninterruptible sleep" and "Sleep system call"?
The previous one has nothing to do with the system call which happened to have a similar name. Yegle (talk) 06:17, 28 February 2014 (UTC)
thread_title:  Uninterruptible sleep and Sleep system call? 

message: Is it worth pointing out the interactions with the Sleep() function and how it's affected by setting the system clock backwards?
Depending on the OS, OS versions, and how programming standard libraries interface with it, sleep can do two things. I've given examples below.
* sleep for 15 seconds, then set the system clock back 1 hour. Thread sleeps for at least 1 hour and 15 seconds
* sleep for 15 seconds, then set the system clock back 1 hour. Thread sleeps for at least 15 seconds
It seems the POSIX standard indirectly implies the latter (https://man7.org/linux/man-pages/man2/clock_settime.2.html#VERSIONS), as does recent the Windows 11 OS. 
Also somewhat related, the MSVC C++17 standard library implementation "std::this_thread::sleep_for" and "std::this_thread::sleep_until" uses the former. That is until v17.9.0 where "sleep_until" uses the latter (https://github.com/microsoft/STL/issues/718). In both cases the C++ standard says it's an implementation decision what happens. I expect other programming languages' standard libraries to have similar confusing quirks. JodiTheEntitled (talk) 21:50, 3 March 2024 (UTC)
thread_title:  Sleep and moving the system clock backwards