33 |
#include "Foundation/NSLock.h" |
#include "Foundation/NSLock.h" |
34 |
#include "Foundation/NSPathUtilities.h" |
#include "Foundation/NSPathUtilities.h" |
35 |
#include "Foundation/NSDictionary.h" |
#include "Foundation/NSDictionary.h" |
36 |
|
#include "Foundation/NSThread.h" |
37 |
|
#include "Foundation/NSNotification.h" |
38 |
|
|
39 |
static NSString* NSCharacterSet_PATH = @"NSCharacterSets"; |
static NSString* NSCharacterSet_PATH = @"NSCharacterSets"; |
40 |
|
|
45 |
|
|
46 |
@implementation NSCharacterSet |
@implementation NSCharacterSet |
47 |
|
|
48 |
|
+ (void) _becomeThreaded: (NSNotification*)notification |
49 |
|
{ |
50 |
|
if (cache_lock == nil) |
51 |
|
{ |
52 |
|
cache_lock = [NSLock new]; |
53 |
|
[[NSNotificationCenter defaultCenter] |
54 |
|
removeObserver: self |
55 |
|
name: NSWillBecomeMultiThreadedNotification |
56 |
|
object: nil]; |
57 |
|
} |
58 |
|
} |
59 |
|
|
60 |
+ (void) initialize |
+ (void) initialize |
61 |
{ |
{ |
62 |
static BOOL one_time = NO; |
static BOOL one_time = NO; |
71 |
} |
} |
72 |
one_time = YES; |
one_time = YES; |
73 |
} |
} |
74 |
|
if ([NSThread isMultiThreaded]) |
75 |
|
{ |
76 |
|
[self _becomeThreaded: nil]; |
77 |
|
} |
78 |
|
else |
79 |
|
{ |
80 |
|
[[NSNotificationCenter defaultCenter] |
81 |
|
addObserver: self |
82 |
|
selector: @selector(_becomeThreaded:) |
83 |
|
name: NSWillBecomeMultiThreadedNotification |
84 |
|
object: nil]; |
85 |
|
} |
86 |
} |
} |
87 |
|
|
88 |
/* Provide a default object for allocation */ |
/* Provide a default object for allocation */ |
99 |
NSString *set_path; |
NSString *set_path; |
100 |
NSBundle *bundle; |
NSBundle *bundle; |
101 |
|
|
|
if (!cache_lock) |
|
|
cache_lock = [NSLock new]; |
|
102 |
[cache_lock lock]; |
[cache_lock lock]; |
103 |
|
|
104 |
set = nil; /* Quiet warnings */ |
set = nil; /* Quiet warnings */ |