cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Crash while using curl_multi_socket_action

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 27 Dec 2011 23:19:32 +0100 (CET)

On Tue, 27 Dec 2011, sandeep a wrote:

> In the call back of CURLMOPT_SOCKETFUNCTION, I am registering another
> callback with libevent which takes care of doing curl_multi_socket_action.
> (Hence making sure curl_mutli_socket_action happens in a different thread).

This sounds scary to me. Are you saying you're using
curl_multi_socket_action() from more than one thread using the same handle?

> In the call back of CURLMOPT_ TIMERFUNCTION, I am registering another
> callback with libevent which takes care of doing curl_multi_socket_action
> but with a timeout value of 0. (Hence making sure curl_mutli_socket_action
> happens in a different thread).

Again. What's all this "different thread" talk when you're using an event
based library and the multi_socket API? Isn't then one of the primary points
to not use multiple threads for the libcurl I/O ?

> And one more question: I would never want to call curl_multi_cleanup as my
> application would always be running. Having said that do I still need to
> call ev_loop(loop, 0) as discussed in the example evhiperfifo.c ???

1. that's just an example, it doesn't dictate what you must do. Also, it's
    mostly matter of how the event library works or not.

2. the call to ev_loop(loop, 0) is not really related to curl_multi_cleanup(),
    it just happens that after ev_loop() returns the function is complete
    and instead of leaking memory the example cleans up the multi handle then

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