cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Does the share interface work?

From: Andy Serpa <ac_at_onehorseshy.com>
Date: Wed, 25 Feb 2004 19:19:19 -0500

Ok, it appears it crashes because I did not set Lock & Unlock
callbacks. I got the impression I didn't need to from this line in
the share overview:

"Since you can use this share from multiple threads, and libcurl has
no internal thread synchronization, you must provide mutex callbacks
if you're using this multi-threaded. You set lock and unlock
functions with curl_share_setopt() too."

My application is single-threaded, so I thought it wasn't
necessary...

-- Andy

> > I noticed that some docs were updated per earlier message on this
> > list regarding the share interface. But the question is -- does it
> > work?
>
> It does. Test case 506 uses the share interface and that test case
> runs fine on numerous platforms all the time.
>
> There are very likely still some bugs lurking in there though!
>
> > I get a crash when I try to share an easy handle. Even with the doc
> > updates, there is still no mention of the CURLOPT_SHARE option in
> > the
> > curl_easy_setopt() docs.
>
> I've added it now.
>
> > In the curl_share overview it says to pass
> > the share handle as a parameter to share an easy handle. But I
> > can't get it to work.
> >
> > Here's what I'm doing (pseudo-code):
> >
> > err = curl_global_init()
> >
> > shareH = curl_share_init()
> >
> > err =
> > curl_share_setopt(shareH,CURLSHOPT_SHARE,CURL_LOCK_DATA_COOKIE) err
> > = curl_share_setopt(shareH,CURLSHOPT_SHARE,CURL_LOCK_DATA_DNS)
> >
> > So far, so good. A handle is returned, and no errors on the option
> > setting. Moving on:
> >
> > easyH = curl_easy_init()
> >
> > err = curl_easy_setopt(easyH,CURLOPT_SHARE,shareH)
> >
> > *** CRASH ***
>
> Enable debug. Run it with a debugger. Tell us why/where it crashes.
> This doesn't happen for me.
>
Received on 2004-02-26