Boost logo

Boost :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2005-06-21 08:53:43


Toon Knapen wrote:

> Markus Schöpflin wrote:

>>What does sysconf(_SC_THREAD_SAFE_FUNCTIONS) return?

> It returns '1' wethere '-mt' is used or not.
>
> But this is a runtime-if. We need a compile-time if to avoid calling
> readdir_r when '-mt' is not used on the command-line.

In your specific case, yes. But generally, you can't rely on that. The
standard says:

<quote>
If a symbolic constant is defined with the value -1, the option is not
supported. Headers, data types, and function interfaces required only for
the option need not be supplied. An application that attempts to use
anything associated only with the option is considered to be requiring an
extension.

If a symbolic constant is defined with a value greater than zero, the
option shall always be supported when the application is executed. All
headers, data types, and functions shall be present and shall operate as
specified.

If a symbolic constant is defined with the value zero, all headers, data
types, and functions shall be present. The application can check at runtime
to see whether the option is supported by calling fpathconf(), pathconf(),
or sysconf() with the indicated name parameter.
</quote>

So in general you have to check with sysconf(_SC_THREAD_SAFE_FUNCTIONS)
during runtime whenever _POSIX_THREAD_SAFE_FUNCTIONS == 0.

But unfortunately this won't help you much. :-(

Markus


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk