mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 17:51:01 +00:00
tweak for OSX compatibility
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29480 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
845bfe3c4c
commit
ad5c68529b
2 changed files with 30 additions and 23 deletions
|
@ -113,6 +113,10 @@ typedef NSInteger NSOperationQueuePriority;
|
|||
/** <override-subclass/>
|
||||
* This is the method which actually performs the operation ...
|
||||
* the default implementation does nothing.<br />
|
||||
* You MUST ensure that your implemention of -main does not raise any
|
||||
* exception or call [NSThread-exit] as either of these will terminate
|
||||
* the operation prematurely resulting in the operation never reaching
|
||||
* the -isFinished state.<br />
|
||||
* If you are writing a concurrent subclass, you should override -start
|
||||
* instead of (or as well as) the -main method.
|
||||
*/
|
||||
|
|
|
@ -360,7 +360,7 @@ static NSArray *empty = nil;
|
|||
- (void) start
|
||||
{
|
||||
CREATE_AUTORELEASE_POOL(pool);
|
||||
NSException *e = nil;
|
||||
double prio = [NSThread threadPriority];
|
||||
|
||||
[internal->lock lock];
|
||||
NS_DURING
|
||||
|
@ -393,24 +393,33 @@ static NSArray *empty = nil;
|
|||
[self willChangeValueForKey: @"isExecuting"];
|
||||
internal->executing = YES;
|
||||
[self didChangeValueForKey: @"isExecuting"];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
[internal->lock unlock];
|
||||
[localException raise];
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
[internal->lock unlock];
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
if (NO == [self isCancelled])
|
||||
{
|
||||
double prio = [NSThread threadPriority];
|
||||
|
||||
[NSThread setThreadPriority: internal->threadPriority];
|
||||
[self main];
|
||||
[NSThread setThreadPriority: prio];
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
e = localException;
|
||||
[NSThread setThreadPriority: prio];
|
||||
[localException raise];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
|
||||
[internal->lock lock];
|
||||
NS_DURING
|
||||
{
|
||||
/* Notify KVO system of changes to isExecuting and isFinished
|
||||
*/
|
||||
[self willChangeValueForKey: @"isExecuting"];
|
||||
|
@ -424,17 +433,11 @@ static NSArray *empty = nil;
|
|||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
if (e == nil)
|
||||
{
|
||||
e = localException;
|
||||
}
|
||||
[internal->lock unlock];
|
||||
[localException raise];
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
[internal->lock unlock];
|
||||
if (e != nil)
|
||||
{
|
||||
[e raise];
|
||||
}
|
||||
RELEASE(pool);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue