Paul Hampson wrote:

> > From: Hindrik Buining
> > Sent: Friday, 22 August 2003 11:54 AM
> 
> > + while( !threads_available() ) {
> > + radlog(L_ERR, "No threads available yet. Sleeping...");
> > + select(0,NULL,NULL,NULL,&sleep_time);
> > + }
> > +
> > status = select(max_fd + 1, &readfds, NULL, NULL, tv);
> 
> Shouldn't the loop appear after the select? That way if
> there's no pending requests in the socket buffer, we don't
> busy-wait needlessly when an io-wait would suffice.

I don't understand why you say it's a busy loop: it isn't going to
take 100% CPU time. Using select(2) is a portable way to sleep for a
short period of time. Perhaps you want to change it with nanosleep(2)
to make the code easier to understand.

-- 
Nicolas Baradakis

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to