Differences From Artifact [3a80ac4df5]:
- File
src/OFThreadPool.m
— part of check-in
[2a27cf3000]
at
2016-01-03 00:41:26
on branch trunk
— Update copyright
While at it, also update the mail address. (user: js, size: 6786) [annotate] [blame] [check-ins using]
To Artifact [629df82865]:
- File src/OFThreadPool.m — part of check-in [e0b9167693] at 2016-02-21 15:37:42 on branch trunk — Make use of C99-style for loops (user: js, size: 6788) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
256 257 258 259 260 261 262 | } - initWithSize: (size_t)size { self = [super init]; @try { | < < | | | | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | } - initWithSize: (size_t)size { self = [super init]; @try { _size = size; _threads = [[OFMutableArray alloc] init]; _queue = [[OFList alloc] init]; _queueCondition = [[OFCondition alloc] init]; _countCondition = [[OFCondition alloc] init]; for (size_t i = 0; i < size; i++) { void *pool = objc_autoreleasePoolPush(); OFThreadPoolThread *thread = [OFThreadPoolThread threadWithThreadPool: self]; [_threads addObject: thread]; objc_autoreleasePoolPop(pool); } /* * We need to start the threads in a separate loop to make sure * _threads is not modified anymore to prevent a race condition. */ for (size_t i = 0; i < size; i++) [[_threads objectAtIndex: i] start]; } @catch (id e) { [self release]; @throw e; } return self; |
︙ | ︙ |