[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Defaults being destroyed
From: |
Alexey I. Froloff |
Subject: |
Re: Defaults being destroyed |
Date: |
Tue, 27 Aug 2002 11:29:35 +0400 |
User-agent: |
Mutt/1.4i |
On Tue, Aug 27, 2002 at 08:14:55AM +0100, Richard Frith-Macdonald wrote:
> >On Tue, Aug 27, 2002 at 07:15:07AM +0100, Stefan Urbanek wrote:
> >[/dev/null]
> >>It seems, that if a program does not see some domain in
> >>database at program startup, it will not write it back. It
> >>may be a problem in -[NSUserDefaults synchronize] I think,
> >>but I am not sure.
> >-[NSUserDefaults synchronize] uses NSLock than works between
> >threads but not processes. Writinig defaults database is not
> >atomic operation.
> Actually, it uses writeToFile:atomically: with the second argument
> set to YES ... so it *IS* an atomic operation.
This is *NOT* atomic operation.
NSData.m:
- (BOOL) writeToFile: (NSString*)path atomically: (BOOL)useAuxiliaryFile
{
[/dev/null]
if (useAuxiliaryFile)
{
NSFileManager *mgr = [NSFileManager defaultManager];
NSMutableDictionary *att = nil;
if ([mgr fileExistsAtPath: path])
{
att = [[mgr fileAttributesAtPath: path
traverseLink: YES] mutableCopy];
IF_NO_GC(TEST_AUTORELEASE(att));
[mgr removeFileAtPath: path handler: nil];
}
/* In this moment file does not exist. */
c = rename(thePath, theRealPath);
> You would only need filesystem locking if the user defaults
> database was split across multiple files.
--
Regards, Sir Raorn.
AIF5-RIPN, AIF5-RIPE, Binec System Administrator.
pgp8PAaUqeybQ.pgp
Description: PGP signature
- Defaults being destroyed, Stefan Urbanek, 2002/08/26
- Re: Defaults being destroyed, Adam Fedor, 2002/08/26
- Re: Defaults being destroyed, Stefan Urbanek, 2002/08/27
- Re: Defaults being destroyed, Alexey I. Froloff, 2002/08/27
- Re: Defaults being destroyed, Richard Frith-Macdonald, 2002/08/27
- Re: Defaults being destroyed,
Alexey I. Froloff <=
- Re: Defaults being destroyed, Richard Frith-Macdonald, 2002/08/27
- Re: Defaults being destroyed, Alexey I. Froloff, 2002/08/27
- Re: Defaults being destroyed, Richard Frith-Macdonald, 2002/08/27
- Re: Defaults being destroyed, Pete French, 2002/08/27
- Re: Defaults being destroyed, Alexey I. Froloff, 2002/08/27
- Re: Defaults being destroyed (Solved?), Stefan Urbanek, 2002/08/27
Re: Defaults being destroyed, Ian Jones, 2002/08/26