mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Minor bugfix patch
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17756 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
47fcfc1ad3
commit
88285c3596
3 changed files with 33 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2003-09-30 Derek Zhou <dzhou@chrontel.com>
|
||||||
|
|
||||||
|
* Source/NSCharacterSet.m: patch to ensure lock is created as
|
||||||
|
soon as the process goes multi-threaded, therefore avoiding
|
||||||
|
a race condition causing a rare exception.
|
||||||
|
|
||||||
2003-09-26 Richard Frith-Macdonald <rfm@gnu.org>
|
2003-09-26 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSString.m: Fix pathExtension bug reported by Roland
|
* Source/NSString.m: Fix pathExtension bug reported by Roland
|
||||||
|
|
|
@ -3377,6 +3377,7 @@ static NSCharacterSet *tokenSet = nil;
|
||||||
/**
|
/**
|
||||||
* Search the content of this document to locate a part whose content ID
|
* Search the content of this document to locate a part whose content ID
|
||||||
* matches the specified key. Recursively descend into other documents.<br />
|
* matches the specified key. Recursively descend into other documents.<br />
|
||||||
|
* Wraps the supplied key in angle brackets if they are not present.<br />
|
||||||
* Return nil if no match is found, the matching GSMimeDocument otherwise.
|
* Return nil if no match is found, the matching GSMimeDocument otherwise.
|
||||||
*/
|
*/
|
||||||
- (id) contentByID: (NSString*)key
|
- (id) contentByID: (NSString*)key
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
#include "Foundation/NSLock.h"
|
#include "Foundation/NSLock.h"
|
||||||
#include "Foundation/NSPathUtilities.h"
|
#include "Foundation/NSPathUtilities.h"
|
||||||
#include "Foundation/NSDictionary.h"
|
#include "Foundation/NSDictionary.h"
|
||||||
|
#include "Foundation/NSThread.h"
|
||||||
|
#include "Foundation/NSNotification.h"
|
||||||
|
|
||||||
static NSString* NSCharacterSet_PATH = @"NSCharacterSets";
|
static NSString* NSCharacterSet_PATH = @"NSCharacterSets";
|
||||||
|
|
||||||
|
@ -43,6 +45,18 @@ static NSLock* cache_lock = nil;
|
||||||
|
|
||||||
@implementation NSCharacterSet
|
@implementation NSCharacterSet
|
||||||
|
|
||||||
|
+ (void) _becomeThreaded: (NSNotification*)notification
|
||||||
|
{
|
||||||
|
if (cache_lock == nil)
|
||||||
|
{
|
||||||
|
cache_lock = [NSLock new];
|
||||||
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
removeObserver: self
|
||||||
|
name: NSWillBecomeMultiThreadedNotification
|
||||||
|
object: nil];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
+ (void) initialize
|
+ (void) initialize
|
||||||
{
|
{
|
||||||
static BOOL one_time = NO;
|
static BOOL one_time = NO;
|
||||||
|
@ -57,6 +71,18 @@ static NSLock* cache_lock = nil;
|
||||||
}
|
}
|
||||||
one_time = YES;
|
one_time = YES;
|
||||||
}
|
}
|
||||||
|
if ([NSThread isMultiThreaded])
|
||||||
|
{
|
||||||
|
[self _becomeThreaded: nil];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
addObserver: self
|
||||||
|
selector: @selector(_becomeThreaded:)
|
||||||
|
name: NSWillBecomeMultiThreadedNotification
|
||||||
|
object: nil];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Provide a default object for allocation */
|
/* Provide a default object for allocation */
|
||||||
|
@ -73,8 +99,6 @@ static NSLock* cache_lock = nil;
|
||||||
NSString *set_path;
|
NSString *set_path;
|
||||||
NSBundle *bundle;
|
NSBundle *bundle;
|
||||||
|
|
||||||
if (!cache_lock)
|
|
||||||
cache_lock = [NSLock new];
|
|
||||||
[cache_lock lock];
|
[cache_lock lock];
|
||||||
|
|
||||||
set = nil; /* Quiet warnings */
|
set = nil; /* Quiet warnings */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue