www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Where is sleep()?

reply Ryan David Sheasby <ryan27968 gmail.com> writes:
Hey guys. First time poster here. I've searched high and low but 
can't seem to find a simple sleep/delay/wait/pause function in 
the core or in phobos. The most recent information I can find 
about it is this forum post from 12 years ago: 
http://forum.dlang.org/thread/avr99b$b8j$2 digitaldaemon.com In 
which they suggest using std.c.time which is now depreciated and 
seems to have been replaced by core.stdc.time which doesn't have 
any sleep functions... What am I missing?
Dec 17 2017
next sibling parent reply rikki cattermole <rikki cattermole.co.nz> writes:
On 17/12/2017 8:32 AM, Ryan David Sheasby wrote:
 Hey guys. First time poster here. I've searched high and low but can't 
 seem to find a simple sleep/delay/wait/pause function in the core or in 
 phobos. The most recent information I can find about it is this forum 
 post from 12 years ago: 
 http://forum.dlang.org/thread/avr99b$b8j$2 digitaldaemon.com In which 
 they suggest using std.c.time which is now depreciated and seems to have 
 been replaced by core.stdc.time which doesn't have any sleep 
 functions... What am I missing?
That link is not relevant to D. https://dlang.org/phobos/core_thread.html#.Thread.sleep
Dec 17 2017
parent Ryan David Sheasby <ryan27968 gmail.com> writes:
On Sunday, 17 December 2017 at 08:40:53 UTC, rikki cattermole 
wrote:
 On 17/12/2017 8:32 AM, Ryan David Sheasby wrote:
 Hey guys. First time poster here. I've searched high and low 
 but can't seem to find a simple sleep/delay/wait/pause 
 function in the core or in phobos. The most recent information 
 I can find about it is this forum post from 12 years ago: 
 http://forum.dlang.org/thread/avr99b$b8j$2 digitaldaemon.com 
 In which they suggest using std.c.time which is now 
 depreciated and seems to have been replaced by core.stdc.time 
 which doesn't have any sleep functions... What am I missing?
That link is not relevant to D. https://dlang.org/phobos/core_thread.html#.Thread.sleep
Crap sorry you're right. I pasted the wrong link. This is the one I was talking about: http://forum.dlang.org/thread/diuepu$2ebg$1 digitaldaemon.com
Dec 17 2017
prev sibling next sibling parent codephantom <me noyb.com> writes:
On Sunday, 17 December 2017 at 08:32:20 UTC, Ryan David Sheasby 
wrote:
 Hey guys. First time poster here. I've searched high and low 
 but can't seem to find a simple sleep/delay/wait/pause function 
 in the core or in phobos. The most recent information I can 
 find about it is this forum post from 12 years ago: 
 http://forum.dlang.org/thread/avr99b$b8j$2 digitaldaemon.com In 
 which they suggest using std.c.time which is now depreciated 
 and seems to have been replaced by core.stdc.time which doesn't 
 have any sleep functions... What am I missing?
// -------------- import std.stdio; import core.thread; void main() { int waitTime = 5; writeln("Waiting ", waitTime, " seconds..."); Thread.sleep(waitTime.seconds); writeln("Done waiting!"); } // --------------
Dec 17 2017
prev sibling next sibling parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Sunday, 17 December 2017 at 08:32:20 UTC, Ryan David Sheasby 
wrote:
 What am I missing?
the official search is hard to use, so I made my own. When looking for something, try dpldocs.info/search_term http://dpldocs.info/sleep and here it pops right up.
Dec 17 2017
parent reply Steven Schveighoffer <schveiguy yahoo.com> writes:
On 12/17/17 8:32 AM, Adam D. Ruppe wrote:
 On Sunday, 17 December 2017 at 08:32:20 UTC, Ryan David Sheasby wrote:
 What am I missing?
the official search is hard to use, so I made my own. When looking for something, try dpldocs.info/search_term http://dpldocs.info/sleep and here it pops right up.
I searched for "sleep" in "library", core.thread was the first result. Now, it would be good to have it link directly to the sleep function itself, but it looks like searching in the library only links to the one-page-per-module version of the docs. If I change google's terms to site:dlang.org/library instead of site:dlang.org/phobos, then searching for sleep gives me the Thread.sleep function as the first result. -Steve
Dec 17 2017
parent Adam D. Ruppe <destructionator gmail.com> writes:
On Sunday, 17 December 2017 at 17:01:37 UTC, Steven Schveighoffer 
wrote:
 I searched for "sleep" in "library", core.thread was the first 
 result.
Yeah, me too (followed by core.time, std.datetime.stopwatch, and std.datetime...), but it isn't obvious any of them are actual winners. If you already basically know what you're looking for, it can refresh, but if it is first time core.thread - D Programming Language https://dlang.org/phobos/core_thread.html Jump to: getAll · getThis · id · isDaemon · isRunning · join · name · opApply · priority · PRIORITY_DEFAULT · PRIORITY_MAX · PRIORITY_MIN · sleep · start · this · yield. class Thread ;. This class encapsulates all threading functionality for the D programming language. As thread manipulation is a required facility for garbage ... doesn't really indicate it was a good hit and when the click the page, even finding that jumplist takes a second search. This is one of the better results I tend to get off the official site. Whereas mine gives: http://dpldocs.info/sleep core.​thread.​Thread.​sleep Suspends the calling thread for at least the supplied period. This may result in multiple OS calls if period is greater than the maximum sleep duration supported by the operating system. immediately, right there on the result page. As well as other hits such as vibe.d's sleep.
Dec 17 2017
prev sibling parent =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 12/17/2017 12:32 AM, Ryan David Sheasby wrote:

 I've searched high and low but can't
 seem to find a simple sleep/delay/wait/pause function in the core or in
 phobos.
Prepending "dlang" to Google searches has been working well for me. Googling for "dlang sleep" lists the documentation as the first hit for me. Same with "dlang phobos sleep", "dlang druntime sleep", etc. Ali
Dec 17 2017