checkEvents/select in 0.8.1

Guenther Grau grau at fzi.de
Mon Feb 24 09:34:26 PST 1997


Frank Mehnert wrote:
> 
Hi,

>     FD_COPY(&readsPending, &rd);
>     FD_COPY(&writesPending, &wr);
>     ...
>     r = (*select_call)(maxFd+1, &rd, &wr, 0, 0);
>     ...
> 
> But readsPending and writesPending ar'nt initialized:
> 
>     static fd_set readsPending;
>     static fd_set writesPending;
> 
> should'nt there be lines such as
> 
>     FD_ZERO(&readsPending);
>     FD_ZERO(&writesPending);

Hmm, first of all, AFAIK, static variables are guaranteed
to be zero'd. This is demanded by ansi-c. (Reuse of
these variables will have the effect that the old
value is still in there which might, or might not
be a problem, depending on whether this is intended or not :-)
Second, dependent on the implementation of FD_COPY,
which I cannot find on any of my machines, you might not
need to initalize it. But I might be mising something
here as you didn't provide enough code to really know
what's going on and I don't have the src to look at
right now.

  Guenther


More information about the kaffe mailing list