www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Thread Sleep

reply BizarreCake <bizarrecake gmail.com> writes:
I wonder why there isn't any sleep method in std.concurrency.
I know there is one in core.thread, but I try to avoid using
core modules.

Maybe a sleep method is just not needed in std.concurrency?

If I were to make a program that would constantly have about
60 working threads. Some kind of sleeping mechanism is a must
in my opinion.

Someone please answer! ^^
Thanks.
Aug 08 2011
parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Monday 08 August 2011 07:01:11 BizarreCake wrote:
 I wonder why there isn't any sleep method in std.concurrency.
 I know there is one in core.thread, but I try to avoid using
 core modules.
 
 Maybe a sleep method is just not needed in std.concurrency?
 
 If I were to make a program that would constantly have about
 60 working threads. Some kind of sleeping mechanism is a must
 in my opinion.
 
 Someone please answer! ^^
 Thanks.

It's not there, because it's in core.thread. We're not going to duplicate code just so that it's in std instead of core. If the functionality that you need is in core, then use core. I don't see any reason to avoid it beyond the fact that a large portion of it is C declarations which Phobos uses to implement nicer, D functions which are then what you'd use. But if it's D code, then there's no reason not to use it. It's there to be used, and it's not going to be duplicated in std. - Jonathan M Davis
Aug 08 2011