This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: select () confusion


  > 
  > Yeah, that's because the reason it was there originally was for
  > efficiency,
  > and we know that's not relevant for Windows ;).
  > 
LMAO, I agree.  But, doesn't that assume that the programmer actually
knows how to program efficiently?  I mean wouldn't it be more efficient
for someone that knows what efficient is to do this internally?

  > >  Since FD_SET always
  > > increments the fd count anyhow, I don't see a point in even using
the
  > > first parameter.
  > 
  > Eh? FD_SET doesn't change the value of the highest fd you will be
  > selecting
  > on, or the number of fds you have. It just sets a bit in a bitmask
(the
  > fdset).
  > 

Oh, I was referring to the windows docs.  I guess they are completely
different.  I can definitely see why that would be efficient now.  After
all, an fd_set in eCos is only an array of integer masks.  Bit
manipulation is much faster than going through an array of SOCKETs.

eCos fd_set
typedef	struct fd_set {
	fd_mask	fds_bits[__howmany(FD_SETSIZE, __NFDBITS)];
} fd_set;

windows fd_set (LMAO, they suck)
typedef struct fd_set {
  u_int    fd_count;                 // how many are SET? 
  SOCKET   fd_array[FD_SETSIZE];     // an array of SOCKETs 
} fd_set;


And, infact windows does increment an fdcount! :) LOL


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]