Zero timeout receive
James Wirth
jwirth1 at suddenlink.net
Thu Apr 18 18:41:33 PDT 2013
On Tuesday, 16 April 2013 at 21:38:39 UTC, Sean Kelly wrote:
> On Apr 15, 2013, at 7:22 PM, James Wirth
> <jwirth1 at suddenlink.net> wrote:
>>
>> Special casing receiveTimeout would introduce less name bloat
>> but might impact other receive performance. As a Java
>> programmer I tend to ignore slowdowns of 2:1 and as a Python
>> programmer even 70:1 - but I could see that system programmers
>> might disagree.
>
> Currently, receiveTimeout will call Condition.wait(n) for any
> wait time passed. For a wait time of 0, this will be
> equivalent to a yield(), so the calling thread will be
> suspended for a context switch if there are other threads
> waiting to run. I could special case this to not wait at all,
> but am inclined to say that the yield() effect is a good thing
> here, as it helps concurrency.
Many Thanks, I appreciate the "hand holding". Will use
receiveTimeout(0,...) without fear henceforth. I think yielding
in the windows event thread will indeed benefit the application.
More information about the Digitalmars-d
mailing list