summaryrefslogtreecommitdiff
path: root/lib/libpthread/arch/hppa/_atomic_lock.c
blob: 9882303e3884dcc19bc284255f049b1d7b31af62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*	$OpenBSD: _atomic_lock.c,v 1.2 2002/10/11 19:08:41 marc Exp $	*/
/*
 * Atomic lock for hppa
 */
#include "spinlock.h"

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

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

	return (old == _SPINLOCK_LOCKED);
}