cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-library Mailing List Archives

Re: Threading and general usage in C++

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 19 Apr 2001 20:51:36 +0200 (MET DST)

On Thu, 19 Apr 2001, Gabriel Ambuehl wrote:

> I've just started using libcurl as I couldn't find any other lib that
> sanely implements HTTP(S) and FTP

Well, libcurl is designed for exactly this.

> GPL code isn't viable[1], LGPL is fine though).

Another design goal of libcurl.

[chunks of code removed]

> On FreeBSD, this compiles with some warnings about libc not being
> THREAD_SAFE but despite, it works. Now trouble starts if one adds a
> mycurl[1].Start() (after the second setUrl) which results in an immediate
> segfault and core dump that is obviously related to libcurl since it
> won't occur if check isn't called in Run() (run is some sort of main()
> for the thread).

I can't say I understand your piece of code, as some parts are obviously
missing. Also, you didn't mention what version of the library this is, so I
assume it is 7.7.1.

Are you doing curl_easy_init() for each new thread? You can't re-use the same
handle over thread-boundaries.

If you do, where exactly is the crash occuring? Can you show us a stack
trace?

Another note, a source code comment says: "docs say one has to set the
options again after each request". It isn't true. If you want the options to
remain the same, you don't have to touch them again.

> Now is there any halfway reliable information about the thread safety of
> libcurl (Daniel states thinks it should be, but that he didn't test)?

I didn't, but others have. I think it is fairly safe to say that libcurl is
thread-safe.

> despite the use of
>
> cout << curl_easy_setopt(curl, CURLOPT_MUTE, 1);
>
> curl_easy_perform() will dump everything to the console

*everything* ? If you include the file itself in "everything" it is because
by default all output of received data is passed to stdout. If you mean the
progress meter stuff, that is shut off separately.

I know this should probably be fixed and documented better.

> [2] I wonder whether I should try to write some Python wrapper to the lib
> to see if performance would improve.

I would welcome a Python wrapper, so if you end up making one, I'm all ears!
;-)

-- 
  Daniel Stenberg -- curl project maintainer -- http://curl.haxx.se/
_______________________________________________
Curl-library mailing list
Curl-library_at_lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/curl-library
Received on 2001-04-19

These mail archives are generated by hypermail.

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

File upload with ASP.NET