ObjFW  Diff

Differences From Artifact [2f72c3fe38]:

To Artifact [8a0ae17cde]:


301
302
303
304
305
306
307
















308
309
310
311
312
313
314
		of_thread_detach(thread);

	[object release];
	[returnValue release];

	[super dealloc];
}
















@end

@implementation OFTLSKey
+ (void)initialize
{
	if (self == [OFTLSKey class])
		TLSKeys = [[OFList alloc] init];







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
		of_thread_detach(thread);

	[object release];
	[returnValue release];

	[super dealloc];
}

- (void)finalize
{
	if (running == OF_THREAD_RUNNING)
		@throw [OFThreadStillRunningException newWithClass: isa
							    thread: self];

	/*
	 * We should not be running anymore, but call detach in order to free
	 * the resources.
	 */
	if (running == OF_THREAD_WAITING_FOR_JOIN)
		of_thread_detach(thread);

	[super finalize];
}
@end

@implementation OFTLSKey
+ (void)initialize
{
	if (self == [OFTLSKey class])
		TLSKeys = [[OFList alloc] init];
383
384
385
386
387
388
389


















390
391
392
393
394
395
396
		@synchronized (TLSKeys) {
			[TLSKeys removeListObject: listObject];
		}
	}

	[super dealloc];
}


















@end

@implementation OFMutex
+ mutex
{
	return [[[self alloc] init] autorelease];
}







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
		@synchronized (TLSKeys) {
			[TLSKeys removeListObject: listObject];
		}
	}

	[super dealloc];
}

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

	if (initialized)
		of_tlskey_free(key);

	/* In case we called [self release] in init */
	if (listObject != NULL) {
		@synchronized (TLSKeys) {
			[TLSKeys removeListObject: listObject];
		}
	}

	[super finalize];
}
@end

@implementation OFMutex
+ mutex
{
	return [[[self alloc] init] autorelease];
}
434
435
436
437
438
439
440










441
442
443
444
445
446
447
	if (initialized)
		if (!of_mutex_free(&mutex))
			@throw [OFMutexStillLockedException newWithClass: isa
								   mutex: self];

	[super dealloc];
}










@end

@implementation OFCondition
+ condition
{
	return [[[self alloc] init] autorelease];
}







>
>
>
>
>
>
>
>
>
>







468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
	if (initialized)
		if (!of_mutex_free(&mutex))
			@throw [OFMutexStillLockedException newWithClass: isa
								   mutex: self];

	[super dealloc];
}

- (void)finalize
{
	if (initialized)
		if (!of_mutex_free(&mutex))
			@throw [OFMutexStillLockedException newWithClass: isa
								   mutex: self];

	[super finalize];
}
@end

@implementation OFCondition
+ condition
{
	return [[[self alloc] init] autorelease];
}
488
489
490
491
492
493
494











495
		if (!of_condition_free(&condition))
			@throw [OFConditionStillWaitingException
			    newWithClass: isa
			       condition: self];

	[super dealloc];
}











@end







>
>
>
>
>
>
>
>
>
>
>

532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
		if (!of_condition_free(&condition))
			@throw [OFConditionStillWaitingException
			    newWithClass: isa
			       condition: self];

	[super dealloc];
}

- (void)finalize
{
	if (conditionInitialized)
		if (!of_condition_free(&condition))
			@throw [OFConditionStillWaitingException
			    newWithClass: isa
			       condition: self];

	[super finalize];
}
@end