receiveTimeout minimum reasonable timeout value?
Charles Hixson via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu May 15 16:57:48 PDT 2014
On Thursday, May 15, 2014 08:21:41 PM JR via Digitalmars-d-learn wrote:
> On Thursday, 15 May 2014 at 18:15:46 UTC, Charles Hixson via
>
> Digitalmars-d-learn wrote:
> > Duration can be specified in nanoseconds, but does it make any
> > sense
> > to have a value of 1 nanosecond? 0?
> >
> > My desire is to check whether a message is in the queue, and
> > then
> > either move it local to the thread, or continue, depending.
>
> I use 0.seconds for such oneshot receive attempts. Snippet:
>
> while (!halt) {
> if (++readCounter > messageCheckFrequency) {
> receiveTimeout(0.seconds,
> &_verbose.fun,
> &_quiet.fun,
> &_unknown.fun
> );
>
> readCounter = 0;
> }
>
> slice = conn.stream.readLine(buf);
> // ...
> }
Thanks. That's what I was hoping to hear.
More information about the Digitalmars-d-learn
mailing list