curl-library
Re: [SAD TRUTH] does curl_multi handle can be accessed from 2 threads?
Date: Tue, 5 Sep 2006 17:17:50 +0200
On Tue, Sep 05, 2006 at 02:29:26PM +0200, Christian Grade wrote:
> If one puts locks for the multi-interface *outside* the interface instead
> of locking *in* it, the multi-interface is ever-lastingly locked during
> transfer, whereas I claim it should be able to potentially permanently
> download something and at the same time take in new transfer requests.
I think it is possible to do this; temporarily release the lock inside your
registered callback function which is called whenever new data arrives. If
you have a wait()/notify() mechanism (a monitor), you'd call notify() from
the callback and your main thread would be able to do whatever it likes
with libcurl.
ISTR you can set a timeout to avoid the case that all curl-multi file
descriptors are waiting for data. Is it curl_easy_setopt(CURLOPT_TIMEOUT)?
Then you can call curl_multi_perform() in a loop and also release the lock
between these calls.
Cheers,
Richard
-- __ _ |_) /| Richard Atterer | GnuPG key: 888354F7 | \/¯| http://atterer.net | 08A9 7B7D 3D13 3EF2 3D25 D157 79E6 F6DC 8883 54F7 ¯ '` ¯Received on 2006-09-05