mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-29 16:01:38 +00:00
complete NSGarbageCollector class
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27653 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
185221a9f4
commit
39b3249632
3 changed files with 43 additions and 12 deletions
|
@ -34,8 +34,9 @@ static unsigned disabled = 0;
|
|||
#include <gc.h>
|
||||
|
||||
#import "Foundation/NSLock.h"
|
||||
static NSLock *lock = nil;
|
||||
|
||||
#import "Foundation/NSHashTable.h"
|
||||
static NSLock *lock = nil;
|
||||
static NSHashTable *uncollectable = 0;
|
||||
#endif
|
||||
|
||||
@implementation NSGarbageCollector
|
||||
|
@ -82,8 +83,16 @@ static NSLock *lock = nil;
|
|||
|
||||
- (void) disableCollectorForPointer: (void *)ptr
|
||||
{
|
||||
// FIXME
|
||||
[self notImplemented: _cmd];
|
||||
#if GS_WITH_GC
|
||||
[lock lock];
|
||||
if (uncollectable == 0)
|
||||
{
|
||||
uncollectable = NSCreateHashTableWithZone(NSOwnedPointerHashCallBacks,
|
||||
0, GSScannedMallocZone());
|
||||
}
|
||||
NSHashInsertIfAbsent(uncollectable, ptr);
|
||||
[lock unlock];
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -103,8 +112,14 @@ static NSLock *lock = nil;
|
|||
|
||||
- (void) enableCollectorForPointer: (void *)ptr
|
||||
{
|
||||
// FIXME
|
||||
[self notImplemented: _cmd];
|
||||
#if GS_WITH_GC
|
||||
[lock lock];
|
||||
if (uncollectable != 0)
|
||||
{
|
||||
NSHashRemove(uncollectable, ptr);
|
||||
}
|
||||
[lock unlock];
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue