non-block reading from pipe stdout
Oleg B
code.viator at gmail.com
Tue Oct 3 21:04:23 UTC 2017
On Tuesday, 3 October 2017 at 12:32:43 UTC, kdevel wrote:
> IMHO a program should sleep (consume 0 CPU time and 0 energy)
> if there is nothing to process. This is best accomplished by
> not polling on a file descriptor in order to check if data has
> arrived. If your program must yield() there's probably
> something wrong with the design. I would suggest you put all
> the filedescriptors into a fd_set an then select(3) on the set.
Programs based on fibers can't sleep while wait data and it's not
a design problem.
More information about the Digitalmars-d-learn
mailing list