diff --git a/ChangeLog b/ChangeLog index 51048c6b51..b163629a52 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-07-18 Larry Campbell + + * Source/NSThread.m: Send notification about becoming multithreaded + when the new thread is registered from outside our API. + 2016-07-18 Richard Frith-Macdonald * Source/NSOperation.m: avoid sorting the queue ... keep the array of diff --git a/Source/NSAutoreleasePool.m b/Source/NSAutoreleasePool.m index ba32d4b972..781cb6c3e2 100644 --- a/Source/NSAutoreleasePool.m +++ b/Source/NSAutoreleasePool.m @@ -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" diff --git a/Source/NSConcreteHashTable.m b/Source/NSConcreteHashTable.m index c2b6fbff96..046ca7c11e 100644 --- a/Source/NSConcreteHashTable.m +++ b/Source/NSConcreteHashTable.m @@ -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" diff --git a/Source/NSConcreteMapTable.m b/Source/NSConcreteMapTable.m index 3dfc3f01a0..0f1ab194e9 100644 --- a/Source/NSConcreteMapTable.m +++ b/Source/NSConcreteMapTable.m @@ -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" diff --git a/Source/NSGarbageCollector.m b/Source/NSGarbageCollector.m index 1520a08a70..cc3b9656c7 100644 --- a/Source/NSGarbageCollector.m +++ b/Source/NSGarbageCollector.m @@ -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 @@ -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 @@ -83,11 +76,7 @@ - (BOOL) isCollecting - (BOOL) isEnabled { - if (disabled) - { - return NO; - } - return YES; + return NO; } - (NSZone*) zone diff --git a/Source/NSThread.m b/Source/NSThread.m index f682686679..9f9ac49c2b 100644 --- a/Source/NSThread.m +++ b/Source/NSThread.m @@ -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" @@ -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(); } @@ -764,7 +762,6 @@ @implementation NSThread [(GSRunLoopThreadInfo*)thread->_runLoopInfo invalidate]; RELEASE(thread); - [[NSGarbageCollector defaultCollector] enableCollectorForPointer: thread]; pthread_setspecific(thread_object_key, nil); } } @@ -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;