Index: src/OFThreadPool.h ================================================================== --- src/OFThreadPool.h +++ src/OFThreadPool.h @@ -15,11 +15,11 @@ */ #import "OFObject.h" #ifdef OF_HAVE_BLOCKS -typedef void (^of_thread_pool_block_t)(id object); +typedef void (^of_thread_pool_block_t)(void); #endif @class OFMutableArray; @class OFList; @class OFCondition; @@ -105,19 +105,10 @@ * \brief Executes the specified block as soon as a thread is ready. * * \param block The block to execute */ - (void)dispatchWithBlock: (of_thread_pool_block_t)block; - -/** - * \brief Executes the specified block as soon as a thread is ready. - * - * \param block The block to execute - * \param object The object to pass to the block - */ -- (void)dispatchWithBlock: (of_thread_pool_block_t)block - object: (id)object; #endif /** * \brief Waits until all jobs are done. */ Index: src/OFThreadPool.m ================================================================== --- src/OFThreadPool.m +++ src/OFThreadPool.m @@ -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