ObjFW  Check-in [cb6e353487]

Overview
Comment:More secure way to unlock spinlocks.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: cb6e353487d5f1e6ae3e485da37eaf63f3c51cb321caf40cdec81a6a442f2d5f
User & Date: js on 2010-02-01 14:20:09
Other Links: manifest | tags
Context
2010-02-01
16:29
Retain object passed to OFThread instead of copying. check-in: 7ebc9b62e0 user: js tags: trunk
14:20
More secure way to unlock spinlocks. check-in: cb6e353487 user: js tags: trunk
2010-01-31
22:05
Small optimization. check-in: 305317e5ea user: js tags: trunk
Changes

Modified src/threading.h from [b78d28aec0] to [bf0ea6d5c4].

238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
#endif
}

static OF_INLINE BOOL
of_spinlock_unlock(of_spinlock_t *s)
{
#if defined(OF_ATOMIC_OPS)
	*s = 0;
	return YES;
#elif defined(OF_HAVE_PTHREAD_SPINLOCKS)
	return (pthread_spin_unlock(s) ? NO : YES);
#else
	return of_mutex_unlock(s);
#endif
}







|







238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
#endif
}

static OF_INLINE BOOL
of_spinlock_unlock(of_spinlock_t *s)
{
#if defined(OF_ATOMIC_OPS)
	of_atomic_and32((uint32_t*)s, 0);
	return YES;
#elif defined(OF_HAVE_PTHREAD_SPINLOCKS)
	return (pthread_spin_unlock(s) ? NO : YES);
#else
	return of_mutex_unlock(s);
#endif
}