[Babel-users] time, syscall, etc.
kerneis at pps.jussieu.fr
kerneis at pps.jussieu.fr
Fri Jul 15 18:26:13 UTC 2011
Matthieu,
On Fri, Jul 15, 2011 at 07:55:55PM +0200, Matthieu Boutier wrote:
> Is FD_ZERO a non-raming* syscall?
FD_ZERO is really nothing more than a memset. (It is not even a syscall
actually.)
> It seems necessary to do a gettime(&now); only after select (in the other
> case we don't have wait anything). So I think it's better to put gettime in
> the "if" statement. If you think that checking for the next timeout may take
> a consequent time, so put the first "gettime" just before the "if".
But it's easier to read that way, you do not need to think about it for a long
time to convince yourself that now is really now (and gettimeofday is not
that expensive in most cases).
> babel.c, somewhere near 590-610:
> if(errno != EAGAIN && errno != EINTR) {
> perror("recv");
> sleep(1);
> }
> Euhm… why blocking the entire rest of the program just because of a EAGAIN ?
> Don't we would sleep (if necessary) at the "select" ?
Well select told you there are data available, but you cannot read them:
something is going wrong. You do not want to trigger a busy loop if this
behaviour happens several times in a row, so you just sleep a bit for things to
calm down ;-)
Best,
--
Gabriel
More information about the Babel-users
mailing list