/[gnustep]/gnustep/core/base/Source/NSCharacterSet.m
ViewVC logotype

Diff of /gnustep/core/base/Source/NSCharacterSet.m

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.41 by fedor, Sat Jun 7 01:24:40 2003 UTC revision 1.42 by CaS, Tue Sep 30 17:47:35 2003 UTC
# Line 33  Line 33 
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    
# Line 43  static NSLock* cache_lock = nil; Line 45  static NSLock* cache_lock = nil;
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;
# Line 57  static NSLock* cache_lock = nil; Line 71  static NSLock* cache_lock = nil;
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 */
# Line 73  static NSLock* cache_lock = nil; Line 99  static NSLock* cache_lock = nil;
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 */

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.42

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26