summaryrefslogtreecommitdiff
path: root/lib/libpthread/arch/hppa64/_atomic_lock.c
blob: e9ca71cf72107e2f733fc17294a4dfae94f6b9de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*	$OpenBSD: _atomic_lock.c,v 1.2 2011/11/14 15:16:12 jsing Exp $	*/
/*
 * Atomic lock for hppa
 */
#include "spinlock.h"

int
_atomic_lock(volatile _spinlock_lock_t *lock)
{
	register register_t old;

	__asm__("ldcws 0(%1), %0" : "=r" (old): "r" (lock));

	return (old == _SPINLOCK_LOCKED);
}