@@ -73,12 +73,12 @@ #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFNotImplementedException.h" #import "OFOutOfRangeException.h" #ifdef OF_HAVE_THREADS -# import "OFThreadJoinFailedException.h" -# import "OFThreadStartFailedException.h" +# import "OFJoinThreadFailedException.h" +# import "OFStartThreadFailedException.h" # import "OFThreadStillRunningException.h" #endif #ifdef OF_MINT /* freemint-gcc does not have trunc() */ @@ -131,12 +131,12 @@ * Nasty workaround for thread implementations which can't return a * pointer on join, or don't have a way to exit a thread. */ if (setjmp(thread->_exitEnv) == 0) { # ifdef OF_HAVE_BLOCKS - if (thread->_threadBlock != NULL) - thread->_returnValue = [thread->_threadBlock() retain]; + if (thread->_block != NULL) + thread->_returnValue = [thread->_block() retain]; else # endif thread->_returnValue = [[thread main] retain]; } @@ -158,11 +158,11 @@ [thread release]; } @synthesize name = _name; # ifdef OF_HAVE_BLOCKS -@synthesize threadBlock = _threadBlock; +@synthesize block = _block; # endif + (void)initialize { if (self != [OFThread class]) @@ -177,13 +177,13 @@ { return [[[self alloc] init] autorelease]; } # ifdef OF_HAVE_BLOCKS -+ (instancetype)threadWithThreadBlock: (OFThreadBlock)threadBlock ++ (instancetype)threadWithBlock: (OFThreadBlock)block { - return [[[self alloc] initWithThreadBlock: threadBlock] autorelease]; + return [[[self alloc] initWithBlock: block] autorelease]; } # endif + (OFThread *)currentThread { @@ -378,16 +378,16 @@ return self; } # ifdef OF_HAVE_BLOCKS -- (instancetype)initWithThreadBlock: (OFThreadBlock)threadBlock +- (instancetype)initWithBlock: (OFThreadBlock)block { self = [self init]; @try { - _threadBlock = [threadBlock copy]; + _block = [block copy]; } @catch (id e) { [self release]; @throw e; } @@ -435,11 +435,11 @@ _running = OFThreadStateRunning; if ((error = OFPlainThreadNew(&_thread, [_name cStringWithEncoding: [OFLocale encoding]], callMain, self, &_attr)) != 0) { [self release]; - @throw [OFThreadStartFailedException + @throw [OFStartThreadFailedException exceptionWithThread: self errNo: error]; } } @@ -446,16 +446,16 @@ - (id)join { int error; if (_running == OFThreadStateNotRunning) - @throw [OFThreadJoinFailedException + @throw [OFJoinThreadFailedException exceptionWithThread: self errNo: EINVAL]; if ((error = OFPlainThreadJoin(_thread)) != 0) - @throw [OFThreadJoinFailedException exceptionWithThread: self + @throw [OFJoinThreadFailedException exceptionWithThread: self errNo: error]; _running = OFThreadStateNotRunning; return _returnValue; @@ -541,11 +541,11 @@ if (_running == OFThreadStateWaitingForJoin) OFPlainThreadDetach(_thread); [_returnValue release]; # ifdef OF_HAVE_BLOCKS - [_threadBlock release]; + [_block release]; # endif [super dealloc]; } #else