Re: RAND_egd() blocking -- despite contract that states otherwise?
On Thu, Nov 6, 2008 at 9:11 PM, David Schwartz <firstname.lastname@example.org> wrote:
> > There needs to be a call to fcntl(fd,F_SETFL,O_NONBLOCK) just after
> > the socket() call and error status check.[/color]
> That will just waste CPU. The code will spin in each loop "while
> (!success)" loop until it gets what it wants. It will still not return any
> time soon, but will do so at 100% CPU instead of 0% CPU.
> Unless I'm missing something.
> It looks like the default error handler will catch EWOULDBLOCK and "goto[/color]
err", breaking out of the while() loop. If EWOULDBLOCK happened during
connect() then "0" is returned, If it happens during read() or write() then
-1 is returned. Is this an important discrepancy?