Back to index

glibc  2.9
Functions
pspinlock.c File Reference
#include <errno.h>
#include <pthread.h>
#include "internals.h"

Go to the source code of this file.

Functions

int __pthread_spin_lock (pthread_spinlock_t *lock)
 weak_alias (__pthread_spin_lock, pthread_spin_lock)
 weak_alias (__pthread_spin_trylock, pthread_spin_trylock)
 weak_alias (__pthread_spin_unlock, pthread_spin_unlock)
 weak_alias (__pthread_spin_init, pthread_spin_init)

Function Documentation

int __pthread_spin_lock ( pthread_spinlock_t *  lock)

Definition at line 25 of file pspinlock.c.

{
  __asm__ __volatile__("1: bset %1, (%0); beq 1b"
                     : : "a" (lock), "d" (1) : "memory");
  return 0;
}

Here is the call graph for this function:

Definition at line 31 of file pspinlock.c.

{
  int oldval = 1;

  __asm__ __volatile__ ("bset %0, (%1); beq 1f; clr %0; 1:" :
                     "+d" (oldval) : "a" (lock) : "memory");

  return oldval ? EBUSY : 0;
}

Here is the call graph for this function:

Definition at line 44 of file pspinlock.c.

{
  *lock = 0;
  return 0;
}

Definition at line 53 of file pspinlock.c.

{
  /* We can ignore the `pshared' parameter.  Since we are busy-waiting
     all processes which can access the memory location `lock' points
     to can use the spinlock.  */
  *lock = 0;
  return 0;
}

Definition at line 65 of file pspinlock.c.

{
  /* Nothing to do.  */
  return 0;
}