cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Openssl crashing when linked against curl(multithreaded setup) in AIX 64 bit platform

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 10 Feb 2014 08:38:39 +0100 (CET)

On Mon, 10 Feb 2014, Arunav Sanyal wrote:

> I am using CURLOPT_NOSIGNAL option as true. No I tried to look for some
> answers and found this thread(namely locking_function and threadid_func):-
>
> http://curl.haxx.se/docs/faq.html#Is_libcurl_thread_safe
>
> This gives pointers to examples in Solaris and Win32 examples for certain
> callback handlers needed for correct thread safe usage.
>
> Now I didnt browse through curl source but I believe that these callback
> handlers must be implemented in curl_global_init().

No.

As the documentation tries to describe, the responsibility to set those
callbacks are with the application.

libcurl has no threads on its own that it needs to protect and it doesn't know
what thread library/concept you use so it cannot on its own set the callbacks.

This has been the subject for discussion before and there are indeed valid
reasons to reconsider what we can and should do, but this is how things have
been since forever and still are.

> More importantly, I don't quite understand why curl didn't handle this in
> their baseline implementation?

Basiscally the reasons are:

- with *nix, we can't _know_ which threading model you use and thus we cannot
   do mutexes without making assumptions

- if we'd make assumptions and we'd add mutex callbacks, we'd add dependencies
   on a threading library even for all those users who don't use threading

... but I'm always open for further discussions! There are good reasons for
why libcurl should do them on its own.

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