Re: Extended attributes and thread safety

Graham Lee <[email protected]>
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
On Aug 31, 2009, at 10:06 , Christiaan Hofman wrote:

>
> On Aug 31, 2009, at 8:36, Chris Suter wrote:
>
>> Hi Christian,
>>
>> On Sun, Aug 30, 2009 at 9:48 PM, Christiaan  
>> Hofman<[email protected]> wrote:
>>> Does anybody know whether it is safe to use the extended attribute  
>>> C-library
>>> at sys/xattr.h (getxattr, setxattr, etc) on background threads? The
>>> documentation does not mention anything about thread safety, but I  
>>> could
>>> imagine it to run into problems if it'd use global resources, and  
>>> the
>>> functions seem to use at least one global variable.
>>
>> Those functions will be thread safe. It's a bug if they're not.
>>
>> Kind regards,
>>
>> Chris
>
> Thanks Chris. However I am still worried about the fact that they  
> access the global variable errno.

On Mac OS X, errno is a macro wrapping access to a thread-safe variable:

extern int * __error(void);
#define errno (*__error())

Cheers,
Graham.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.