mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-29 16:01:38 +00:00
More simplification by using lazy locking
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@18559 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
cf6e91f1fd
commit
d04dcc7fb8
9 changed files with 37 additions and 350 deletions
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "GNUstepBase/GSLock.h"
|
||||
#include "Foundation/NSArray.h"
|
||||
#include "Foundation/NSBitmapCharSet.h"
|
||||
#include "Foundation/NSException.h"
|
||||
|
@ -46,18 +47,6 @@ static Class abstractClass = 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;
|
||||
|
@ -67,18 +56,7 @@ static Class abstractClass = nil;
|
|||
abstractClass = [NSCharacterSet class];
|
||||
one_time = YES;
|
||||
}
|
||||
if ([NSThread isMultiThreaded])
|
||||
{
|
||||
[self _becomeThreaded: nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(_becomeThreaded:)
|
||||
name: NSWillBecomeMultiThreadedNotification
|
||||
object: nil];
|
||||
}
|
||||
cache_lock = [GSLazyLock new];
|
||||
}
|
||||
|
||||
/* Provide a default object for allocation */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue