ObjFW  Diff

Differences From Artifact [6d911d6e5b]:

To Artifact [8a610bd39b]:


237
238
239
240
241
242
243
244

245
246
247
248
249
250
251
237
238
239
240
241
242
243

244
245
246
247
248
249
250
251







-
+







	self = [super init];

	@try {
		if (!of_tlskey_new(&key))
			@throw [OFInitializationFailedException
			    newWithClass: isa];

		destructor = NULL;
		initialized = YES;

		@synchronized (tlskeys) {
			listobj = [tlskeys appendObject: self];
		}
	} @catch (id e) {
		[self release];
		@throw e;
264
265
266
267
268
269
270

271

272
273
274
275
276
277
278
264
265
266
267
268
269
270
271

272
273
274
275
276
277
278
279







+
-
+







}

- (void)dealloc
{
	if (destructor != NULL)
		destructor(self);

	if (initialized)
	of_tlskey_free(key);
		of_tlskey_free(key);

	/* In case we called [self release] in init */
	if (listobj != NULL) {
		@synchronized (tlskeys) {
			[tlskeys removeListObject: listobj];
		}
	}
293
294
295
296
297
298
299


300
301
302
303
304
305
306
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309







+
+








	if (!of_mutex_new(&mutex)) {
		Class c = isa;
		[self release];
		@throw [OFInitializationFailedException newWithClass: c];
	}

	initialized = YES;

	return self;
}

- (void)lock
{
	if (!of_mutex_lock(&mutex))
		@throw [OFMutexLockFailedException newWithClass: isa];
315
316
317
318
319
320
321

322

323
324
325
326
318
319
320
321
322
323
324
325

326
327
328
329
330







+
-
+




{
	if (!of_mutex_unlock(&mutex))
		@throw [OFMutexUnlockFailedException newWithClass: isa];
}

- (void)dealloc
{
	if (initialized)
	of_mutex_free(&mutex);
		of_mutex_free(&mutex);

	[super dealloc];
}
@end