cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: a curl_multi_fdset() replacement? (TODO-RELEASE #55)

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Mon, 31 Jan 2005 13:59:09 +0100 (CET)

On Mon, 31 Jan 2005, Richard Atterer wrote:

> Is there any reason why you want to allocate extra memory?

Because there is (currently) zero or one file descriptor per easy handle, so
you need an array that fits the same number of descriptors as number of easy
handles. It could be many. (Of course we also want to allow more than one
descriptor per handle, should the need arise in the future.)

I want libcurl to "own" the memory for the arrays, since then libcurl can keep
the arrays around for the next call and it won't have to realloc() arrays that
already have a proper size. Which in real life will mean that for most calls
to this functions, there will be no malloc() or realloc() needed.

> Maybe it would be more efficient to allow users to pass in a pointer to a
> function, which is called for each socket?

To me, that seems like more overhead and complexity for an app. You would
typically call this curl-function every time you want to do select() or
poll().

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2005-01-31