ObjFW  Check-in [20aea410be]

Overview
Comment:Fix code used when atomic ops are unavailable.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 20aea410be6e603c1714d640a44ad9a3ae52c87476045ce795296b3e99f563fa
User & Date: js on 2013-01-12 20:32:00
Other Links: manifest | tags
Context
2013-01-12
20:53
Clean up the feature #ifdef mess. check-in: b8ce2359f3 user: js tags: trunk
20:32
Fix code used when atomic ops are unavailable. check-in: 20aea410be user: js tags: trunk
20:21
Fix --disable-threads. check-in: 85b8efadbc user: js tags: trunk
Changes

Modified src/OFObject.m from [431202d1e9] to [1c57171d5d].

972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
- retain
{
#if defined(OF_ATOMIC_OPS)
	of_atomic_inc_32(&PRE_IVARS->retainCount);
#elif defined(OF_THREADS)
	OF_ENSURE(of_spinlock_lock(&PRE_IVARS->retainCountSpinlock));
	PRE_IVARS->retainCount++;
	OF_ENSURE(of_spinlock_unlock(&PRE_IVARS->retainCountSspinlock));
#else
	PRE_IVARS->retainCount++;
#endif

	return self;
}








|







972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
- retain
{
#if defined(OF_ATOMIC_OPS)
	of_atomic_inc_32(&PRE_IVARS->retainCount);
#elif defined(OF_THREADS)
	OF_ENSURE(of_spinlock_lock(&PRE_IVARS->retainCountSpinlock));
	PRE_IVARS->retainCount++;
	OF_ENSURE(of_spinlock_unlock(&PRE_IVARS->retainCountSpinlock));
#else
	PRE_IVARS->retainCount++;
#endif

	return self;
}

Modified src/OFThreadPool.m from [320a09e8c2] to [b48920db5d].

327
328
329
330
331
332
333

334

335
336
337
338
339
340
341
	[countCondition release];

	[super dealloc];
}

- (void)OF_dispatchJob: (OFThreadPoolJob*)job
{

	of_atomic_inc_int(&count);


	[queueCondition lock];
	@try {
		[queue appendObject: job];
		[queueCondition signal];
	} @finally {
		[queueCondition unlock];







>
|
>







327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
	[countCondition release];

	[super dealloc];
}

- (void)OF_dispatchJob: (OFThreadPoolJob*)job
{
	[countCondition lock];
	count++;
	[countCondition unlock];

	[queueCondition lock];
	@try {
		[queue appendObject: job];
		[queueCondition signal];
	} @finally {
		[queueCondition unlock];