|
Boost : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2005-04-04 19:51:30
"Jonathan Wakely" <cow_at_[hidden]> wrote in message
news:20050404134320.GA88664_at_compsoc.man.ac.uk...
> Out of interest, why can't you just use _SC_THREAD_SAFE_FUNCTIONS if it's
> defined?
>
> Also, if _POSIX_THREAD_SAFE_FUNCTIONS == 0, I thought that meant *not*
> supported (in which case sysconf() would return -1) ? Does the test have
> to be >= not just > ?
>
> I'd have written it:
>
> # if defined(_SC_THREAD_SAFE_FUNCTIONS)
> if ( ::sysconf( _SC_THREAD_SAFE_FUNCTIONS ) > 0 )
> { return ::readdir_r( dirp, entry, result ); }
> # endif
>
> But I didn't realise this wasn't good enough :-|
This is the first time I've ever used the POSIX config mechanisms, so I may
have it wrong. I'll check... Hum... I find the POSIX docs for sysconf()
pretty impeneratable regarding the return value. I can see why I took >=0 to
be needed, but I could also read it in a way that >0 would be OK.
Any POSIX experts out there?
> Finally, readdir_r() is available on FreeBSD even though neither
> _POSIX_THREAD_SAFE_FUNCTIONS not _SC_THREAD_SAFE_FUNCTIONS is defined.
> I don't know how to test for it though, FreeBSD's sysconf() only claims
> to support POSIX 1990, even though some later interfaces are available.
Someone with access to that system needs to figure out what PP macro to look
for.
Thanks,
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk