mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Add some diagnostics for defaults locking
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39537 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3140fc60a6
commit
112285aab2
3 changed files with 19 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
|||
2016-03-14 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSUserDefaults.m: Log is we break the lock.
|
||||
* Source/NSDistributedLock.m: Unlock if dealloc'ed while locked.
|
||||
|
||||
2016-03-12 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSUserDefaults.m: Remove five year old code for converting
|
||||
|
|
|
@ -99,6 +99,12 @@ static NSFileManager *mgr = nil;
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
if (_lockTime != nil)
|
||||
{
|
||||
NSLog(@"[%@-dealloc] still locked for %@ since %@",
|
||||
NSStringFromClass([self class]), _lockPath, _lockTime);
|
||||
[self unlock];
|
||||
}
|
||||
RELEASE(_lockPath);
|
||||
RELEASE(_lockTime);
|
||||
[super dealloc];
|
||||
|
@ -214,7 +220,7 @@ static NSFileManager *mgr = nil;
|
|||
if (locked == NO)
|
||||
{
|
||||
NSLog(@"Failed to create lock directory '%@' - %@",
|
||||
_lockPath, [NSError _last]);
|
||||
_lockPath, [NSError _last]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -230,7 +236,8 @@ static NSFileManager *mgr = nil;
|
|||
if (attributes == nil)
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
format: @"Unable to get attributes of lock file we made"];
|
||||
format: @"Unable to get attributes of lock file we made at %@",
|
||||
_lockPath];
|
||||
}
|
||||
ASSIGN(_lockTime, [attributes fileModificationDate]);
|
||||
return YES;
|
||||
|
|
|
@ -2357,13 +2357,15 @@ static BOOL isLocked = NO;
|
|||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* If lockDate is nil, we should be able to lock again ... but we
|
||||
/* If lockDate is nil, we should be able to lock again ... but we
|
||||
* wait a little anyway ... so that in the case of a locking
|
||||
* problem we do an idle wait rather than a busy one.
|
||||
*/
|
||||
if (lockDate != nil && [when timeIntervalSinceDate: lockDate] > 5.0)
|
||||
if (lockDate != nil
|
||||
&& [when timeIntervalSinceDate: lockDate] > 5.0)
|
||||
{
|
||||
NSLog(@"NSUserdefaults file lock at %@ is dated %@ ... break",
|
||||
_fileLock, lockDate);
|
||||
[_fileLock breakLock];
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue