cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Does the share interface work?

From: Andy Serpa <ac_at_onehorseshy.com>
Date: Thu, 26 Feb 2004 06:38:21 -0500

> On Wed, 25 Feb 2004, Andy Serpa wrote:
>
> > 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...
>
> Aha. It certainly sounds like a bug, since I agree with you that those
> callbacks shouldn't be mandatory.
>
> Care to write a patch for this?
>

You're talking to Mr. Non-C coder, remember? So no, I couldn't do
that.

But it should be pretty simple, no? Init the callbacks to NULL
automatically, and if they're NULL, then don't call them. (It
appears to call them both right away when you set the CURLOPT_SHARE
option for the easy handle, as well as later when you actually use
the handle for a transfer.)

For now, I'll just use my two dummy callbacks....

-- Andy
Received on 2004-02-26