NIO+Multithreaded TCPSocket listener, very low cpu utilisation
ade90036
andrea.rizzini at gmail.com
Wed Nov 15 09:11:00 UTC 2017
On Tuesday, 14 November 2017 at 21:09:40 UTC, kdevel wrote:
> On Tuesday, 14 November 2017 at 19:57:54 UTC, ade90036 wrote:
>
>> while(true) {
>> listeningSet.add(listener);
>> if (Socket.select(listeningSet, null, null,
>> dur!"nsecs"(150)) > 0) {
>
> Why do you ever timeout? This loop consumes 100 % (a single
> core) when idle on my machine.
Thanks for you feedback, i'll make those cosmetic changes to the
HTTP response
Why do i specify a timeout in the Socket.select?
I have noticed that if i don't specify a timeout the
Socket.select seems to block every so often for several seconds
(2/5sec) and i have read in another post to specify a timeout
value to the call.
I'll retest now.
More information about the Digitalmars-d-learn
mailing list