cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Is CURLOPT_NOSIGNAL a requirement?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 13 Dec 2002 13:34:53 +0100 (MET)

On Thu, 12 Dec 2002, John Blanco wrote:

> I'm writing an application, a photo viewer, that shows a 2x2 matrix
> of Internet WebCams by continually redisplaying JPEG images over and over.
> This is done by using 4 threads all running at once.
>
> I keep seeing references to CURLOPT_NOSIGNAL, but I want to know if
> it *must* be used. Problem is that when the timeout doesn't trigger, all
> the cameras can get hung up because every minute or so I require that all
> threads be killed and if the easy_perform() function hangs, the whole app
> hangs.

No, you don't *have to* use it. If you run on Windows, it does no difference.

On *nix-like systems, if you don't set NOSIGNAL to TRUE, libcurl will use
alarm() and then siglongjmp() to abort slow DNS resolves.

Without NOSIGNAL set to FALSE (which is default), libcurl has no way of
aborting a slow DNS resolve.

> With the assumption that if one cam has a DNS timeout, say, then it's OK
> for the other cams to be interrupted by a SIGALRM, would it be fair to say
> that the CURLOPT_NOSIGNAL option is not *required* for multi-threaded
> programs--only ones that would be affected in a bad way if all the threads
> were interrupted?

AFAIK, it isn't always specified what happens with signals in a
multi-threaded system, it depends on your OS and your thread implementation.
Which thread receives the signal etc.

-- 
 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility 
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/
Received on 2002-12-13