mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Optimisation changes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4103 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5f299bcb7b
commit
917f1542c2
12 changed files with 654 additions and 527 deletions
|
@ -293,23 +293,23 @@ static int messages_received_count;
|
|||
*/
|
||||
+ (NSConnection*) defaultConnection
|
||||
{
|
||||
static NSString* tkey = @"NSConnectionThreadKey";
|
||||
NSConnection* c;
|
||||
NSThread* t;
|
||||
static NSString *tkey = @"NSConnectionThreadKey";
|
||||
NSConnection *c;
|
||||
NSMutableDictionary *d;
|
||||
|
||||
t = GSCurrentThread();
|
||||
c = (NSConnection*)[[t threadDictionary] objectForKey:tkey];
|
||||
d = GSCurrentThreadDictionary();
|
||||
c = (NSConnection*)[d objectForKey:tkey];
|
||||
if (c != nil && [c isValid] == NO) {
|
||||
/*
|
||||
* If the default connection for this thread has been invalidated -
|
||||
* release it and create a new one.
|
||||
*/
|
||||
[[t threadDictionary] removeObjectForKey:tkey];
|
||||
[d removeObjectForKey:tkey];
|
||||
c = nil;
|
||||
}
|
||||
if (c == nil) {
|
||||
c = [NSConnection new];
|
||||
[[t threadDictionary] setObject:c forKey:tkey];
|
||||
[d setObject:c forKey:tkey];
|
||||
[c release]; /* retained in dictionary. */
|
||||
}
|
||||
return c;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue