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 35 of file pspinlock.c.

{
  asm volatile("    basr  1,0\n"
              "0:  slr   0,0\n"
              "    cs    0,1,%1\n"
              "    jl    0b\n"
              : "=m" (*lock)
              : "m" (*lock) : "0", "1", "cc" );
  return 0;
}

Definition at line 45 of file pspinlock.c.

{
  int oldval;

  asm volatile("    slr   %1,%1\n"
              "    basr  1,0\n"
              "0:  cs    %1,1,%0"
              : "=m" (*lock), "=&d" (oldval)
              : "m" (*lock) : "1", "cc" );
  return oldval == 0 ? 0 : EBUSY;
}

Definition at line 59 of file pspinlock.c.

{
  asm volatile("    xc 0(4,%0),0(%0)\n"
              "    bcr 15,0"
              : : "a" (lock) : "memory" );
  return 0;
}

Definition at line 70 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 82 of file pspinlock.c.

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