@@ -29,19 +29,19 @@ { id _target; SEL _selector; id _object; #ifdef OF_HAVE_BLOCKS - of_thread_pool_block_t _block; + OFThreadPoolBlock _block; #endif } - (instancetype)initWithTarget: (id)target selector: (SEL)selector object: (id)object; #ifdef OF_HAVE_BLOCKS -- (instancetype)initWithBlock: (of_thread_pool_block_t)block; +- (instancetype)initWithBlock: (OFThreadPoolBlock)block; #endif - (void)perform; @end @implementation OFThreadPoolJob @@ -62,11 +62,11 @@ return self; } #ifdef OF_HAVE_BLOCKS -- (instancetype)initWithBlock: (of_thread_pool_block_t)block +- (instancetype)initWithBlock: (OFThreadPoolBlock)block { self = [super init]; @try { _block = [block copy]; @@ -95,12 +95,11 @@ #ifdef OF_HAVE_BLOCKS if (_block != NULL) _block(); else #endif - [_target performSelector: _selector - withObject: _object]; + [_target performSelector: _selector withObject: _object]; } @end OF_DIRECT_MEMBERS @interface OFThreadPoolThread: OFThread @@ -161,32 +160,32 @@ for (;;) { OFThreadPoolJob *job; [_queueCondition lock]; @try { - of_list_object_t *listObject; + OFListItem listItem; if (_terminate) { objc_autoreleasePoolPop(pool); return nil; } - listObject = _queue.firstListObject; + listItem = _queue.firstListItem; - while (listObject == NULL) { + while (listItem == NULL) { [_queueCondition wait]; if (_terminate) { objc_autoreleasePoolPop(pool); return nil; } - listObject = _queue.firstListObject; + listItem = _queue.firstListItem; } - job = [[listObject->object retain] autorelease]; - [_queue removeListObject: listObject]; + job = [[OFListItemObject(listItem) retain] autorelease]; + [_queue removeListItem: listItem]; } @finally { [_queueCondition unlock]; } if (_terminate) { @@ -341,11 +340,11 @@ [job release]; } } #ifdef OF_HAVE_BLOCKS -- (void)dispatchWithBlock: (of_thread_pool_block_t)block +- (void)dispatchWithBlock: (OFThreadPoolBlock)block { OFThreadPoolJob *job = [[OFThreadPoolJob alloc] initWithBlock: block]; @try { [self of_dispatchJob: job]; } @finally {