curl-library
Re: Handling GET and POST timeouts
Date: Fri, 18 Mar 2005 23:30:33 +0100 (CET)
On Fri, 18 Mar 2005, Anindya Sinha wrote:
> I am using libcurl for my multi threaded application (using POSIX threads)
> in which I have a maximum of one curl handle associated with each thread. I
> want to add handling for CURLOPT_TIMEOUT. I read the man page, and as far as
> my understanding it suggested to handle it by setting CURLOPT_NOSIGNAL to 1,
> setting appropriate valaue in seconds for CURLOPT_TIMEOUT.
Yes, that's the general approach for multi-threaded apps.
> When the timeout happens, it calls the signal handler for SIGALRM which
> should take care of the event.
No. You set CURLOPT_NOSIGNAL to TRUE which means libcurl will NOT use a signal
to abort anything.
If you set it to FALSE, it will use a signal (alarm()) to abort DNS resolves
and if it triggers, it will call libcurl's signal handler. If you use c-ares
for name resolves, libcurl never uses alarm() while still doing
full-resolution timeouts.
> And do I need to do anything to stop/cleanup of the timer(s) ?
A timeout will result in an aborted transfer. That's all.
-- Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2005-03-18