This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Thread-, Signal- and Cancellation-safety documentation


On 05/19/2013 09:31 AM, Alexandre Oliva wrote:
On May 17, 2013, Torvald Riegel <triegel@redhat.com> wrote:

* There's no clear definition of whether "thread-safe" is about...

There's a clear definition of the specified behavior for each function,
so âfunction F is safe to callâ ought to mean âF behaves as specifiedâ.

But this is clearly wrong for functions such as chdir(). You really shouldn't call them in multi-threaded programs, but they still work exactly as specified.

For the standard, a very narrow (or broad, depending on your perspective) view of what constitutes "thread-safe" makes sense, but for the glibc documentation, we should aim to provide useful guidance for developers and focus on the question if the function is actually usable in a multi-threaded context. Sometimes, there will be an overlap (say, strtok), sometimes, glibc will consider functions thread-safe which aren't in the standard (readdir), sometimes, the standard will label things thread-safe which aren't from our perspective (chdir).

--
Florian Weimer / Red Hat Product Security Team


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]