
On 2/7/06, Giovanni Piero Deretta <gpderetta@gmail.com> wrote:
On 2/7/06, Giovanni P. Deretta <gpderetta@gmail.com> wrote:
Ah, btw, at least on posix systems, file descriptors are guaranteed to be allocated contiguously. So you could create a vector as big as the hightest fd, store the list of operations in it and use the socket_impl as a key for an O(1) lookup in the vector.
This is not true of course... I don't know what i was thinking... Anyway, a file descriptor is *usually* a small integer, so on those systems that keep the set mostly contiguous a vector would work and not waste much space.
Why is not true? I think you were right. Although *all* file descriptors are contiguously, which means that other parts of the program may create "holes" in the vector. But it would work alright (I think ACE does this on Posix systems). -- Felipe Magno de Almeida