Back to index

glibc  2.9
Functions
pspinlock.c File Reference
#include <errno.h>
#include <pthread.h>
#include <sgidefs.h>
#include <sys/tas.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 30 of file pspinlock.c.

{
  unsigned int tmp1, tmp2;

  asm volatile
    ("\t\t\t# spin_lock\n"
     "1:\n\t"
     ".set    push\n\t"
#if _MIPS_SIM == _ABIO32
     ".set    mips2\n\t"
#endif
     "ll      %1,%3\n\t"
     "li      %2,1\n\t"
     "bnez    %1,1b\n\t"
     "sc      %2,%0\n\t"
     ".set    pop\n\t"
     "beqz    %2,1b"
     : "=m" (*lock), "=&r" (tmp1), "=&r" (tmp2)
     : "m" (*lock)
     : "memory");

  return 0;
}

Definition at line 54 of file pspinlock.c.

{
  /* To be done.  */
  return 0;
}

Definition at line 63 of file pspinlock.c.

{
  asm volatile
    ("\t\t\t# spin_unlock\n\t"
     "sw      $0,%0"
     : "=m" (*lock)
     :
     : "memory");
  return 0;
}

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

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