cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: red:call back funcitons

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 3 Jul 2008 12:45:54 +0200 (CEST)

On Thu, 3 Jul 2008, nagarajan.sreenivasan_at_wipro.com wrote:

> A query regarding call back funcitons my_fwrite and read_callback .

I assume you mean the callbacks set with CURLOPT_WRITEFUNCTION and
CURLOPT_READFUNCTION.

> I want to have these 2 fucntions as member functions of a class and use it
> for object specific. I dont want to have them static.

Then you need to do some other wrapper magic.

> as they are not thread safe.

That's by your design, not imposed by libcurl.

> Is it not possible.

Yes it is. libcurl does nothing that prevents you from making the callbacks
entirely thread-safe.

This can be seen in multiple examples and the docs also describes how the data
pointer is passed on to the callbacks to give you the flexibility you need.

-- 
  / daniel.haxx.se
Received on 2008-07-03