cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl multithreading

From: Jamie Lokier <jamie_at_shareable.org>
Date: Fri, 22 Sep 2006 15:07:24 +0100

Török Edvin wrote:
> However I don't understand why the suggested pthread_getspecific fix
> can't be used _if_ pthreads is available. 'pthread_getspecific' is
> part of POSIX Threads extension, and _if_ it is available, then you
> should add support for it. It is not just adding support for some
> weird threading system/API/style/whatever, it is an IEEE standard!
> [http://www.opengroup.org/onlinepubs/009695399/functions/pthread_setspecific.html]
>
> The original 'patch' needed the client to use pthread_setspecific, but
> that can be moved into curl_easy_init.

Beware that pthread_getspecific() is not async-signal-safe on some
platforms, and in the POSIX standards.

One platform where it is definitely not safe is LinuxThreads when the
program uses sigaltstack().

Async-signal-safety applies to functions called from the alarm signal.

-- Jamie
Received on 2006-09-22