@@ -83,12 +83,12 @@ /* * Nasty workaround for thread implementations which can't return a * value on join. */ # ifdef OF_HAVE_BLOCKS - if (thread->_block != NULL) - thread->_returnValue = [thread->_block() retain]; + if (thread->_threadBlock != NULL) + thread->_returnValue = [thread->_threadBlock() retain]; else # endif thread->_returnValue = [[thread main] retain]; [thread handleTermination]; @@ -126,11 +126,11 @@ #endif @implementation OFThread #ifdef OF_HAVE_THREADS # if defined(OF_HAVE_PROPERTIES) && defined(OF_HAVE_BLOCKS) -@synthesize block = _block; +@synthesize threadBlock = _threadBlock; # endif + (void)initialize { if (self != [OFThread class]) @@ -145,13 +145,13 @@ { return [[[self alloc] init] autorelease]; } # ifdef OF_HAVE_BLOCKS -+ (instancetype)threadWithBlock: (of_thread_block_t)block ++ (instancetype)threadWithThreadBlock: (of_thread_block_t)threadBlock { - return [[[self alloc] initWithBlock: block] autorelease]; + return [[[self alloc] initWithThreadBlock: threadBlock] autorelease]; } # endif + (void)setObject: (id)object forTLSKey: (OFTLSKey*)key @@ -266,16 +266,16 @@ @throw [OFInitializationFailedException exceptionWithClass: self]; } # ifdef OF_HAVE_BLOCKS -- initWithBlock: (of_thread_block_t)block +- initWithThreadBlock: (of_thread_block_t)threadBlock { self = [super init]; @try { - _block = [block copy]; + _threadBlock = [threadBlock copy]; } @catch (id e) { [self release]; @throw e; } @@ -380,10 +380,13 @@ if (_running == OF_THREAD_WAITING_FOR_JOIN) of_thread_detach(_thread); [_returnValue release]; [_runLoop release]; +# ifdef OF_HAVE_BLOCKS + [_threadBlock release]; +# endif [super dealloc]; } #else - init