next up previous contents index
Next: 10.2.3 queue.h: Generic queues Up: 10.2 Machine-independent Facilities Previous: 10.2.1 page.h: Page size

10.2.2 spin_lock.h: Spin locks

 

SYNOPSIS

#include <oskit/machine/spin_lock.h>

DESCRIPTION

This file provides the architecture-dependent definition of the spin_lock_t ``spin lock'' data type and associated manipulation macros. This facility provides a basic locking mechanism which can be used with preemptive threading or on a multi-processor.

spin_lock_t
  Typedef for the spin lock data type.
spin_lock_init(s)
  Initialize a spin lock.
spin_lock_locked(s)
  Check if a spin lock is locked.
spin_unlock(s)
  Unlock a spin lock.
spin_try_lock(s)
  Attempt to lock a spin lock. Returns 0 if successful, nonzero if unsuccessful.
spin_lock(s)
  Busy wait until the lock is free. On return the lock has been acquired.

This header file is taken from CMU's Mach kernel.



University of Utah Flux Research Group