mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Thread fixes for NSConnection
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@8174 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d84f89cc45
commit
6c5c018c86
6 changed files with 29 additions and 14 deletions
|
@ -1552,6 +1552,7 @@ static Class tcpPortClass;
|
|||
|
||||
- (void) gcFinalize
|
||||
{
|
||||
NSDebugMLLog(@"NSPort", @"GSTcpPort 0x%x finalized", self);
|
||||
[self invalidate];
|
||||
}
|
||||
|
||||
|
|
|
@ -390,12 +390,12 @@ static IMP initImp;
|
|||
return self;
|
||||
}
|
||||
|
||||
+ (void) _endThread
|
||||
+ (void) _endThread: (NSThread*)thread
|
||||
{
|
||||
struct autorelease_thread_vars *tv;
|
||||
id pool;
|
||||
|
||||
tv = ARP_THREAD_VARS;
|
||||
tv = &(GSCurrentThread()->_autorelease_vars);
|
||||
while (tv->current_pool)
|
||||
{
|
||||
[tv->current_pool release];
|
||||
|
|
|
@ -226,16 +226,13 @@ gnustep_base_thread_callback()
|
|||
[[NSNotificationCenter defaultCenter] postNotification: n];
|
||||
RELEASE(n);
|
||||
|
||||
/*
|
||||
* Release anything in our autorelease pools
|
||||
*/
|
||||
[NSAutoreleasePool _endThread];
|
||||
|
||||
/*
|
||||
* destroy the thread object.
|
||||
*/
|
||||
DESTROY(t);
|
||||
|
||||
objc_thread_set_data (NULL);
|
||||
|
||||
/*
|
||||
* Tell the runtime to exit the thread
|
||||
*/
|
||||
|
@ -332,9 +329,12 @@ gnustep_base_thread_callback()
|
|||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"Deallocating an active thread without [+exit]!"];
|
||||
}
|
||||
_deallocating = YES;
|
||||
DESTROY(_thread_dictionary);
|
||||
DESTROY(_target);
|
||||
DESTROY(_arg);
|
||||
[NSAutoreleasePool _endThread: self];
|
||||
|
||||
NSDeallocateObject(self);
|
||||
}
|
||||
|
||||
|
@ -395,7 +395,7 @@ gnustep_base_thread_callback()
|
|||
*/
|
||||
- (NSMutableDictionary*) threadDictionary
|
||||
{
|
||||
if (_thread_dictionary == nil)
|
||||
if (_thread_dictionary == nil && _deallocating == NO)
|
||||
{
|
||||
_thread_dictionary = [NSMutableDictionary new];
|
||||
}
|
||||
|
@ -450,14 +450,12 @@ gnustep_base_thread_callback()
|
|||
* Set the thread to be inactive to avoid any possibility of recursion.
|
||||
*/
|
||||
thread->_active = NO;
|
||||
/*
|
||||
* Release anything in our autorelease pools
|
||||
*/
|
||||
[NSAutoreleasePool _endThread];
|
||||
|
||||
/*
|
||||
* destroy the thread object.
|
||||
*/
|
||||
DESTROY (thread);
|
||||
|
||||
objc_thread_set_data (NULL);
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue