@@ -35,19 +35,17 @@ + jobWithTarget: (id)target selector: (SEL)selector object: (id)object; #ifdef OF_HAVE_BLOCKS -+ jobWithBlock: (of_thread_pool_block_t)block - object: (id)object; ++ jobWithBlock: (of_thread_pool_block_t)block; #endif - initWithTarget: (id)target selector: (SEL)selector object: (id)object; #ifdef OF_HAVE_BLOCKS -- initWithBlock: (of_thread_pool_block_t)block - object: (id)object; +- initWithBlock: (of_thread_pool_block_t)block; #endif - (void)perform; @end @implementation OFThreadPoolJob @@ -60,15 +58,13 @@ object: object] autorelease]; } #ifdef OF_HAVE_BLOCKS + jobWithBlock: (of_thread_pool_block_t)block - object: (id)object { return [[(OFThreadPoolJob*)[self alloc] - initWithBlock: block - object: object] autorelease]; + initWithBlock: block] autorelease]; } #endif - initWithTarget: (id)target_ selector: (SEL)selector_ @@ -88,17 +84,15 @@ return self; } #ifdef OF_HAVE_BLOCKS - initWithBlock: (of_thread_pool_block_t)block_ - object: (id)object_ { self = [super init]; @try { block = [block_ copy]; - object = [object_ retain]; } @catch (id e) { [self release]; @throw e; } @@ -119,11 +113,11 @@ - (void)perform { #ifdef OF_HAVE_BLOCKS if (block != NULL) - block(object); + block(); else #endif [object performSelector: selector withObject: object]; } @@ -371,22 +365,14 @@ } #ifdef OF_HAVE_BLOCKS - (void)dispatchWithBlock: (of_thread_pool_block_t)block { - [self OF_dispatchJob: [OFThreadPoolJob jobWithBlock: block - object: nil]]; -} - -- (void)dispatchWithBlock: (of_thread_pool_block_t)block - object: (id)object -{ - [self OF_dispatchJob: [OFThreadPoolJob jobWithBlock: block - object: object]]; + [self OF_dispatchJob: [OFThreadPoolJob jobWithBlock: block]]; } #endif - (size_t)size { return size; } @end