@@ -68,11 +68,11 @@ * 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(thread->object) retain]; + thread->returnValue = [thread->block() retain]; else #endif thread->returnValue = [[thread main] retain]; [thread handleTermination]; @@ -112,15 +112,10 @@ + (instancetype)thread { return [[[self alloc] init] autorelease]; } -+ (instancetype)threadWithObject: (id)object -{ - return [[[self alloc] initWithObject: object] autorelease]; -} - #ifdef OF_HAVE_BLOCKS + (instancetype)threadWithBlock: (of_thread_block_t)block { return [[[self alloc] initWithBlock: block] autorelease]; } @@ -239,19 +234,10 @@ if (!of_tlskey_set(threadSelfKey, mainThread)) @throw [OFInitializationFailedException exceptionWithClass: self]; } -- initWithObject: (id)object_ -{ - self = [super init]; - - object = [object_ retain]; - - return self; -} - #ifdef OF_HAVE_BLOCKS - initWithBlock: (of_thread_block_t)block_ { self = [super init]; @@ -273,13 +259,13 @@ return nil; } - (void)handleTermination { - OFRunLoop *tmp = runLoop; + OFRunLoop *oldRunLoop = runLoop; runLoop = nil; - [tmp release]; + [oldRunLoop release]; } - (void)start { if (running == OF_THREAD_RUNNING) @@ -340,11 +326,10 @@ * the resources. */ if (running == OF_THREAD_WAITING_FOR_JOIN) of_thread_detach(thread); - [object release]; [returnValue release]; [runLoop release]; [super dealloc]; }