removal of garbage collection

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39608 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2016-03-25 11:15:28 +00:00
parent 030f54a9cf
commit d40d219015
72 changed files with 122 additions and 1787 deletions

View file

@ -127,15 +127,6 @@ void CFRelease(id obj)
#else
static unsigned disabled = 0;
#if GS_WITH_GC
#include <gc/gc.h>
#import "Foundation/NSLock.h"
#import "Foundation/NSHashTable.h"
static NSLock *lock = nil;
static NSHashTable *uncollectable = 0;
#endif
@implementation NSGarbageCollector
@ -144,79 +135,33 @@ static NSHashTable *uncollectable = 0;
return collector;
}
#if GS_WITH_GC
+ (void) initialize
{
collector = [self alloc];
lock = [NSLock new];
}
#endif
- (void) collectIfNeeded
{
#if GS_WITH_GC
GC_collect_a_little();
#endif
return;
}
- (void) collectExhaustively
{
#if GS_WITH_GC
GC_gcollect();
#endif
return;
}
- (void) disable
{
#if GS_WITH_GC
[lock lock];
GC_disable();
disabled++;
[lock unlock];
#endif
return;
}
- (void) disableCollectorForPointer: (void *)ptr
{
#if GS_WITH_GC
[lock lock];
if (uncollectable == 0)
{
uncollectable = NSCreateHashTable(NSOwnedPointerHashCallBacks, 0);
}
NSHashInsertIfAbsent(uncollectable, ptr);
[lock unlock];
#endif
return;
}
- (void) enable
{
#if GS_WITH_GC
[lock lock];
if (disabled)
{
GC_enable();
disabled--;
}
[lock unlock];
#endif
return;
}
- (void) enableCollectorForPointer: (void *)ptr
{
#if GS_WITH_GC
[lock lock];
if (uncollectable != 0)
{
NSHashRemove(uncollectable, ptr);
}
[lock unlock];
#endif
return;
}