Differences From Artifact [f68a86f2dd]:
- File
src/OFThreadPool.m
— part of check-in
[44f45c2e35]
at
2017-01-09 17:36:36
on branch trunk
— Update copyright
Forgot to add 2017, even though I already did quite some changes in
2017. (user: js, size: 6794) [annotate] [blame] [check-ins using]
To Artifact [04406d7334]:
- File
src/OFThreadPool.m
— part of check-in
[4af49a13c3]
at
2017-05-07 20:10:13
on branch trunk
— Small code style change
Casts are now written like types in variable declarations. (user: js, size: 6799) [annotate] [blame] [check-ins using]
| ︙ | ︙ | |||
127 128 129 130 131 132 133 | OFList *_queue; OFCondition *_queueCondition, *_countCondition; @public volatile bool _terminate; volatile int *_doneCount; } | | | | | | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
OFList *_queue;
OFCondition *_queueCondition, *_countCondition;
@public
volatile bool _terminate;
volatile int *_doneCount;
}
+ (instancetype)threadWithThreadPool: (OFThreadPool *)threadPool;
- initWithThreadPool: (OFThreadPool *)threadPool;
@end
@implementation OFThreadPoolThread
+ (instancetype)threadWithThreadPool: (OFThreadPool *)threadPool
{
return [[[self alloc] initWithThreadPool: threadPool] autorelease];
}
- initWithThreadPool: (OFThreadPool *)threadPool
{
self = [super init];
@try {
_queue = [threadPool->_queue retain];
_queueCondition = [threadPool->_queueCondition retain];
_countCondition = [threadPool->_countCondition retain];
|
| ︙ | ︙ | |||
312 313 314 315 316 317 318 | [_queue release]; [_queueCondition release]; [_countCondition release]; [super dealloc]; } | | | 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 |
[_queue release];
[_queueCondition release];
[_countCondition release];
[super dealloc];
}
- (void)OF_dispatchJob: (OFThreadPoolJob *)job
{
[_countCondition lock];
_count++;
[_countCondition unlock];
[_queueCondition lock];
@try {
|
| ︙ | ︙ |