Socket server + thread: cpu usage

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Apr 29 10:19:40 PDT 2014


On Tuesday, 29 April 2014 at 17:16:33 UTC, Tim wrote:
> Is there anything I'm doing wrong?

You should be using a blocking socket. With them, the operating 
system will put your thread on hold until a new connection comes 
in. Without them, it will endlessly loop doing absolutely nothing 
except checking if a new connection is there yet. Horribly, 
horribly inefficient.


More information about the Digitalmars-d-learn mailing list