ia64/xen-unstable

view extras/mini-os/include/spinlock.h @ 19836:d9890e67d2b7

tools: add SHAREDIR to buildmakevars2file

c/s 19818 dropped SHAREDIR from xen/util/path.py, which broke the "xm
new" command. This patch adds SHAREDIR back to the new
buildmakevars2file-closure function.

Signed-off-by: Ryan O'Connor <rjo@cs.ubc.ca>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jun 25 13:05:10 2009 +0100 (2009-06-25)
parents 707e10c9a487
children
line source
1 #ifndef __ASM_SPINLOCK_H
2 #define __ASM_SPINLOCK_H
4 #include <mini-os/lib.h>
6 /*
7 * Your basic SMP spinlocks, allowing only a single CPU anywhere
8 */
10 typedef struct {
11 volatile unsigned int slock;
12 } spinlock_t;
15 #include <mini-os/arch_spinlock.h>
18 #define SPINLOCK_MAGIC 0xdead4ead
20 #define SPIN_LOCK_UNLOCKED ARCH_SPIN_LOCK_UNLOCKED
22 #define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0)
24 /*
25 * Simple spin lock operations. There are two variants, one clears IRQ's
26 * on the local processor, one does not.
27 *
28 * We make no fairness assumptions. They have a cost.
29 */
31 #define spin_is_locked(x) arch_spin_is_locked(x)
33 #define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x))
36 #define _spin_trylock(lock) ({_raw_spin_trylock(lock) ? \
37 1 : ({ 0;});})
39 #define _spin_lock(lock) \
40 do { \
41 _raw_spin_lock(lock); \
42 } while(0)
44 #define _spin_unlock(lock) \
45 do { \
46 _raw_spin_unlock(lock); \
47 } while (0)
50 #define spin_lock(lock) _spin_lock(lock)
51 #define spin_unlock(lock) _spin_unlock(lock)
53 #define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
55 #endif