mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-29 16:01:38 +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
|
@ -33,6 +33,8 @@
|
|||
#include "Foundation/NSLock.h"
|
||||
#include "Foundation/NSPathUtilities.h"
|
||||
#include "Foundation/NSDictionary.h"
|
||||
#include "Foundation/NSThread.h"
|
||||
#include "Foundation/NSNotification.h"
|
||||
|
||||
static NSString* NSCharacterSet_PATH = @"NSCharacterSets";
|
||||
|
||||
|
@ -43,6 +45,18 @@ static NSLock* cache_lock = nil;
|
|||
|
||||
@implementation NSCharacterSet
|
||||
|
||||
+ (void) _becomeThreaded: (NSNotification*)notification
|
||||
{
|
||||
if (cache_lock == nil)
|
||||
{
|
||||
cache_lock = [NSLock new];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver: self
|
||||
name: NSWillBecomeMultiThreadedNotification
|
||||
object: nil];
|
||||
}
|
||||
}
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
static BOOL one_time = NO;
|
||||
|
@ -57,6 +71,18 @@ static NSLock* cache_lock = nil;
|
|||
}
|
||||
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 */
|
||||
|
@ -73,8 +99,6 @@ static NSLock* cache_lock = nil;
|
|||
NSString *set_path;
|
||||
NSBundle *bundle;
|
||||
|
||||
if (!cache_lock)
|
||||
cache_lock = [NSLock new];
|
||||
[cache_lock lock];
|
||||
|
||||
set = nil; /* Quiet warnings */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue