When a thread ends clear the autorelease pool cache of that thread and

not of the current one.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26819 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2008-08-25 15:39:02 +00:00
parent 6825182e46
commit 314a2da7de
2 changed files with 18 additions and 6 deletions

View file

@ -1,3 +1,10 @@
2008-08-25 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSAutoreleasePool.m (-drain): Implement.
* Source/NSAutoreleasePool.m (-dealloc): Reset _parent and _child.
* Source/NSAutoreleasePool.m (-_endThread:): Free cache of ended
thread not of current.
2008-08-20 Yavor Doganov <yavor@gnu.org> (tiny change)
* config/procfs.m4: Check for `proc' in /proc/mounts rather than

View file

@ -307,7 +307,7 @@ static IMP initImp;
- (void) drain
{
return;
[self dealloc];
}
- (id) retain
@ -340,7 +340,9 @@ static IMP initImp;
if (_parent != nil)
{
_parent->_child = nil;
_parent = nil;
}
_child = nil;
/* Don't deallocate ourself, just save us for later use. */
push_pool_to_cache (tv, self);
@ -453,14 +455,17 @@ static IMP initImp;
+ (void) _endThread: (NSThread*)thread
{
struct autorelease_thread_vars *tv;
id pool;
NSAutoreleasePool *pool;
tv = ARP_THREAD_VARS;
while (tv->current_pool)
tv = &(((TInfo)thread)->_autorelease_vars);
pool = tv->current_pool;
while (pool)
{
[tv->current_pool release];
pool = pop_pool_from_cache(tv);
NSAutoreleasePool *p = pool->_parent;
[pool emptyPool];
[pool _reallyDealloc];
pool = p;
}
free_pool_cache(tv);