cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-library Archives

Re: Cancelling a callback function

From: Alan Wolfe <alan.wolfe_at_gmail.com>
Date: Sun, 27 Feb 2011 22:31:57 -0800

oh and what i mean by saying that curl_easy_perform "blocks" is just
that, by the time curl_easy_perform is done and your code moves to the
next statement, your request will be finished, all your callbacks will
have been called, etc.

On Sun, Feb 27, 2011 at 10:30 PM, Alan Wolfe <alan.wolfe_at_gmail.com> wrote:
> Hey there again.
>
> curel_easy_perform will block until the request is finished, so there
> is no danger of your callback getting called after the free.
>
> If ever you don't want to block your program execution while a request
> happens, you can check out the multi interface.
>
> From what it sounds like, blocking should be fine for your application though.
>
> On Sun, Feb 27, 2011 at 8:23 PM,  <richardcavell_at_mail.com> wrote:
>> Hi everyone.  I'm a newbie trying to learn C99 and write a Wikipedia bot in
>> C.
>>
>> My code does the following things:
>>
>> buffer = malloc (buffersize) ;
>> curl_easy_setopt ( curlhandle, CURLOPT_WRITEFUNCTION, Writememorycallback )
>> ;
>> curl_easy_setopt ( curlhandle, CURLOPT_WRITEDATA, &chunk ) ;
>> curl_easy_perform ();
>>
>> free(buffer);
>>
>> Now, I'm anxious about the possibility that Writememorycallback is going to
>> be called after the free() has released the memory that it's writing into.
>>  Do I need to 'cancel' the callback function to be sure?
>>
>> Richard
>>
>>
>> -------------------------------------------------------------------
>> List admin: http://cool.haxx.se/list/listinfo/curl-library
>> Etiquette:  http://curl.haxx.se/mail/etiquette.html
>>
>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-02-28

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET