Differences From Artifact [2aa1978876]:
- File src/OFThreadPool.m — part of check-in [9558a93c7e] at 2017-05-21 21:33:24 on branch trunk — OFThreadPool: Fix missing autorelease pool (user: js, size: 6396) [annotate] [blame] [check-ins using]
To Artifact [aa9af4f131]:
- File
src/OFThreadPool.m
— part of check-in
[2f4e0df8be]
at
2017-10-17 00:33:37
on branch trunk
— Do not use implicit method return types
Instead, explicitly declare them, as OF_ASSUME_NONNULL_{BEGIN,END} does
not apply to implicit return types. This means that after this commit,
all init methods have a nonnull return type, as they should have. (user: js, size: 6522) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
29 30 31 32 33 34 35 | SEL _selector; id _object; #ifdef OF_HAVE_BLOCKS of_thread_pool_block_t _block; #endif } | | | | | | | | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | SEL _selector; id _object; #ifdef OF_HAVE_BLOCKS of_thread_pool_block_t _block; #endif } - (instancetype)initWithTarget: (id)target selector: (SEL)selector object: (id)object; #ifdef OF_HAVE_BLOCKS - (instancetype)initWithBlock: (of_thread_pool_block_t)block; #endif - (void)perform; @end @implementation OFThreadPoolJob - (instancetype)initWithTarget: (id)target selector: (SEL)selector object: (id)object { self = [super init]; @try { _target = [target retain]; _selector = selector; _object = [object retain]; } @catch (id e) { [self release]; @throw e; } return self; } #ifdef OF_HAVE_BLOCKS - (instancetype)initWithBlock: (of_thread_pool_block_t)block { self = [super init]; @try { _block = [block copy]; } @catch (id e) { [self release]; |
︙ | ︙ | |||
106 107 108 109 110 111 112 | OFCondition *_queueCondition, *_countCondition; @public volatile bool _terminate; volatile int *_doneCount; } + (instancetype)threadWithThreadPool: (OFThreadPool *)threadPool; | | | | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | OFCondition *_queueCondition, *_countCondition; @public volatile bool _terminate; volatile int *_doneCount; } + (instancetype)threadWithThreadPool: (OFThreadPool *)threadPool; - (instancetype)initWithThreadPool: (OFThreadPool *)threadPool; @end @implementation OFThreadPoolThread + (instancetype)threadWithThreadPool: (OFThreadPool *)threadPool { return [[[self alloc] initWithThreadPool: threadPool] autorelease]; } - (instancetype)initWithThreadPool: (OFThreadPool *)threadPool { self = [super init]; @try { _queue = [threadPool->_queue retain]; _queueCondition = [threadPool->_queueCondition retain]; _countCondition = [threadPool->_countCondition retain]; |
︙ | ︙ | |||
224 225 226 227 228 229 230 | } + (instancetype)threadPoolWithSize: (size_t)size { return [[[self alloc] initWithSize: size] autorelease]; } | | | | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | } + (instancetype)threadPoolWithSize: (size_t)size { return [[[self alloc] initWithSize: size] autorelease]; } - (instancetype)init { return [self initWithSize: [OFSystemInfo numberOfCPUs]]; } - (instancetype)initWithSize: (size_t)size { self = [super init]; @try { _size = size; _threads = [[OFMutableArray alloc] init]; _queue = [[OFList alloc] init]; |
︙ | ︙ |