示例#1
0
static int
pthread__ras_simple_lock_try(__cpu_simple_lock_t *alp)
{
	int locked;

	RAS_START(pthread__lock);
	locked = __SIMPLELOCK_LOCKED_P(alp);
	__cpu_simple_lock_set(alp);
	RAS_END(pthread__lock);

	return !locked;
}
示例#2
0
/*
 * Prevent this routine from being inlined.  The common case is no
 * contention and it's better to not burden the instruction decoder.
 */
static void 
pthread__spinlock_slow(pthread_spin_t *lock)
{
	pthread_t self;
	int count;

	self = pthread__self();

	do {
		count = pthread__nspins;
		while (__SIMPLELOCK_LOCKED_P(lock) && --count > 0)
			pthread__smt_pause();
		if (count > 0) {
			if ((*self->pt_lockops.plo_try)(lock))
				break;
			continue;
		}
		sched_yield();
	} while (/*CONSTCOND*/ 1);
}
示例#3
0
static bool __diagused
linux_work_locked(struct work_struct *work)
{
	return __SIMPLELOCK_LOCKED_P(&work->w_lock);
}