ObjFW  Diff

Differences From Artifact [f68a86f2dd]:

To Artifact [04406d7334]:


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
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;
+ (instancetype)threadWithThreadPool: (OFThreadPool *)threadPool;
- initWithThreadPool: (OFThreadPool *)threadPool;
@end

@implementation OFThreadPoolThread
+ (instancetype)threadWithThreadPool: (OFThreadPool*)threadPool
+ (instancetype)threadWithThreadPool: (OFThreadPool *)threadPool
{
	return [[[self alloc] initWithThreadPool: threadPool] autorelease];
}

- initWithThreadPool: (OFThreadPool*)threadPool
- 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
319

320
321
322
323
324
325
326
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
- (void)OF_dispatchJob: (OFThreadPoolJob *)job
{
	[_countCondition lock];
	_count++;
	[_countCondition unlock];

	[_queueCondition lock];
	@try {