Skip to content

Commit

Permalink
gnustep_global_lock is removed
Browse files Browse the repository at this point in the history
  • Loading branch information
rfm committed May 30, 2024
1 parent 276d12d commit 7a98157
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 21 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2024-05-30 Richard Frith-Macdonald <[email protected]>

* Source/GSDisplayServer.m:
* Source/NSGraphicsContext.m:
* Source/NSWorkspace.m:
Avoid using old gnustep_global_lock (removed from base)

2024-05-26 Fred Kiefer <[email protected]>

* ChangeLog: Update for new release
Expand Down
2 changes: 0 additions & 2 deletions Source/GSDisplayServer.m
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ + (void) initialize
{
if (serverLock == nil)
{
[gnustep_global_lock lock];
if (serverLock == nil)
{
serverLock = [NSRecursiveLock new];
Expand All @@ -132,7 +131,6 @@ + (void) initialize
windowmaps = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
NSNonOwnedPointerMapValueCallBacks, 20);
}
[gnustep_global_lock unlock];
}
}

Expand Down
2 changes: 0 additions & 2 deletions Source/NSGraphicsContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ + (void) initialize
{
if (contextLock == nil)
{
[gnustep_global_lock lock];
if (contextLock == nil)
{
contextLock = [NSRecursiveLock new];
Expand All @@ -147,7 +146,6 @@ + (void) initialize
classMethodTable =
[[NSMutableDictionary allocWithZone: _globalGSZone] init];
}
[gnustep_global_lock unlock];
}
}

Expand Down
28 changes: 11 additions & 17 deletions Source/NSWorkspace.m
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ + (BOOL)_exists: (int)pid;
static NSImage *unknownApplication = nil;
static NSImage *unknownTool = nil;

static NSLock *classLock = nil;
static NSLock *mlock = nil;

static NSString *GSWorkspaceNotification = @"GSWorkspaceNotification";
Expand Down Expand Up @@ -598,26 +599,22 @@ + (void) initialize
{
if (self == [NSWorkspace class])
{
static BOOL beenHere = NO;
NSFileManager *mgr = [NSFileManager defaultManager];
NSString *service;
NSData *data;
NSDictionary *dict;

[self setVersion: 1];

[gnustep_global_lock lock];
if (beenHere == YES)
if (classLock)
{
[gnustep_global_lock unlock];
return;
}

beenHere = YES;
classLock = [NSLock new];
mlock = [NSLock new];

NS_DURING
{
NSFileManager *mgr = [NSFileManager defaultManager];
NSString *service;
NSData *data;
NSDictionary *dict;


service = [[NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
NSUserDomainMask, YES) objectAtIndex: 0]
stringByAppendingPathComponent: @"Services"];
Expand Down Expand Up @@ -675,12 +672,9 @@ + (void) initialize
}
NS_HANDLER
{
[gnustep_global_lock unlock];
[localException raise];
}
NS_ENDHANDLER

[gnustep_global_lock unlock];
}
}

Expand All @@ -698,14 +692,14 @@ + (NSWorkspace*) sharedWorkspace
{
if (sharedWorkspace == nil)
{
[gnustep_global_lock lock];
[classLock lock];
if (sharedWorkspace == nil)
{
sharedWorkspace =
(NSWorkspace*)NSAllocateObject(self, 0, NSDefaultMallocZone());
[sharedWorkspace init];
}
[gnustep_global_lock unlock];
[classLock unlock];
}
return sharedWorkspace;
}
Expand Down

0 comments on commit 7a98157

Please sign in to comment.