www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Waiting around

--001517402a80683eb404b61f3f24
Content-Type: text/plain; charset=ISO-8859-1

Hello,

I need to connect to a network location and read a file but I also need
some way of waiting around until the connection is established.  Currently
I use the following snippet to do this:

while (!std.file.exists("/Volumes/mountedDir/myfile.txt") && timeout < 30)
{
        core.thread.Thread.sleep(10_000_000);  // core.thread.Thread
conflicts with std.regex.Thread, hence the full path reference
        timeout++;
}

with the recent changes to std.regex it stopped compiling due to the
"Thread" conflict.  Is there a more obvious way to do what I'm doing that
avoids importing core.thread?

Thanks,
Josh

--001517402a80683eb404b61f3f24
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div>Hello,</div><div><br></div><div>I need to connect to a network locatio=
n and read a file but I also need some way of waiting around until the conn=
ection is established. =A0Currently I use the following snippet to do this:=
 =A0 =A0=A0</div>
<div><br></div><div>while (!std.file.exists(&quot;/Volumes/mountedDir/myfil=
e.txt&quot;) &amp;&amp; timeout &lt; 30)=A0</div><div>{</div><div>=A0 =A0 =
=A0 =A0 core.thread.Thread.sleep(10_000_000); =A0// core.thread.Thread conf=
licts with std.regex.Thread, hence the full path reference</div>
<div>=A0 =A0 =A0 =A0 timeout++;</div><div>}</div><div><br></div><div>with t=
he recent changes to std.regex it stopped compiling due to the &quot;Thread=
&quot; conflict. =A0Is there a more obvious way to do what I&#39;m doing th=
at avoids importing core.thread?</div>
<div><br></div><div>Thanks,</div><div>Josh</div>

--001517402a80683eb404b61f3f24--
Jan 09 2012