Skip to content

Commit

Permalink
patch by Larry Campbell plus removal of some garbage collection vestiges
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@40008 72102866-910b-0410-8b05-ffd578937521
  • Loading branch information
rfm committed Jul 18, 2016
1 parent 9188a05 commit 27899e4
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 22 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,3 +1,8 @@
2016-07-18 Larry Campbell <lcampbel@akamai.com>

* Source/NSThread.m: Send notification about becoming multithreaded
when the new thread is registered from outside our API.

2016-07-18 Richard Frith-Macdonald <rfm@gnu.org>

* Source/NSOperation.m: avoid sorting the queue ... keep the array of
Expand Down
1 change: 0 additions & 1 deletion Source/NSAutoreleasePool.m
Expand Up @@ -30,7 +30,6 @@
#define EXPOSE_NSAutoreleasePool_IVARS 1
#define EXPOSE_NSThread_IVARS 1
#import "Foundation/NSAutoreleasePool.h"
#import "Foundation/NSGarbageCollector.h"
#import "Foundation/NSException.h"
#import "Foundation/NSThread.h"

Expand Down
1 change: 0 additions & 1 deletion Source/NSConcreteHashTable.m
Expand Up @@ -33,7 +33,6 @@
#import "Foundation/NSDictionary.h"
#import "Foundation/NSEnumerator.h"
#import "Foundation/NSException.h"
#import "Foundation/NSGarbageCollector.h"
#import "Foundation/NSHashTable.h"

#import "NSConcretePointerFunctions.h"
Expand Down
1 change: 0 additions & 1 deletion Source/NSConcreteMapTable.m
Expand Up @@ -33,7 +33,6 @@
#import "Foundation/NSDictionary.h"
#import "Foundation/NSEnumerator.h"
#import "Foundation/NSException.h"
#import "Foundation/NSGarbageCollector.h"
#import "Foundation/NSMapTable.h"

#import "NSConcretePointerFunctions.h"
Expand Down
19 changes: 4 additions & 15 deletions Source/NSGarbageCollector.m
Expand Up @@ -26,14 +26,11 @@
#import "common.h"
#import "Foundation/NSGarbageCollector.h"

static NSGarbageCollector *collector = nil;
static unsigned disabled = 0;

@implementation NSGarbageCollector

+ (id) defaultCollector
{
return collector;
return nil;
}

- (void) collectIfNeeded
Expand Down Expand Up @@ -68,12 +65,8 @@ - (void) enableCollectorForPointer: (void *)ptr

- (id) init
{
if (self != collector)
{
[self dealloc];
self = nil;
}
return self;
[self dealloc];
return nil;
}

- (BOOL) isCollecting
Expand All @@ -83,11 +76,7 @@ - (BOOL) isCollecting

- (BOOL) isEnabled
{
if (disabled)
{
return NO;
}
return YES;
return NO;
}

- (NSZone*) zone
Expand Down
8 changes: 4 additions & 4 deletions Source/NSThread.m
Expand Up @@ -73,7 +73,6 @@
#import "Foundation/NSConnection.h"
#import "Foundation/NSInvocation.h"
#import "Foundation/NSUserDefaults.h"
#import "Foundation/NSGarbageCollector.h"
#import "Foundation/NSValue.h"

#import "GSPrivate.h"
Expand Down Expand Up @@ -734,7 +733,6 @@ @implementation NSThread
static void
setThreadForCurrentThread(NSThread *t)
{
[[NSGarbageCollector defaultCollector] disableCollectorForPointer: t];
pthread_setspecific(thread_object_key, t);
gnustep_base_thread_callback();
}
Expand Down Expand Up @@ -764,7 +762,6 @@ @implementation NSThread
[(GSRunLoopThreadInfo*)thread->_runLoopInfo invalidate];
RELEASE(thread);

[[NSGarbageCollector defaultCollector] enableCollectorForPointer: thread];
pthread_setspecific(thread_object_key, nil);
}
}
Expand All @@ -784,9 +781,12 @@ + (BOOL) _createThreadForCurrentPthread
{
t = [self new];
t->_active = YES;
[[NSGarbageCollector defaultCollector] disableCollectorForPointer: t];
pthread_setspecific(thread_object_key, t);
GS_CONSUMED(t);
if (defaultThread != nil && t != defaultThread)
{
gnustep_base_thread_callback();
}
return YES;
}
return NO;
Expand Down

0 comments on commit 27899e4

Please sign in to comment.