Thread.sleep( dur!("msecs")( 50 ) ); // sleep for 50 milliseconds

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 30 03:04:23 PST 2015


On Friday, January 30, 2015 10:39:44 Suliman via Digitalmars-d-learn wrote:
>       foreach(f; files))
>       {
>           if (canFind(to!string(f), " "))
>           {
>               writeln("whitespace found:");
>               writeln(f);
>               Thread.sleep( dur!("msecs")( 50 ) );  // sleep for 50
> milliseconds
>           }
>           else
>               continue;
>       }
>
> Error: module app struct std.regex.Thread(DataIndex) is private
> Error: no property 'sleep' for type 'void'
>
> What's wrong? Why sleeping do not work?

Did you import std.regex but not core.thread? Or did you import std.regex
with a local import and core.thread with a module-level import?

Unfortunately, private symbols are visible and can cause symbol conflicts
(even though they can't actually be used), so sometimes we end up with
conflicts due to private symbols. Being more specific - e.g.
core.Thread.sleep() - should fix the problem. But it's also possible that
you failed to import core.thread in the first place, in which case,
Thread.sleep isn't even visible to your code.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list