Back to index

glibc  2.9
Functions
pthread_spin_lock.c File Reference
#include "pthreadP.h"

Go to the source code of this file.

Functions

int pthread_spin_lock (pthread_spinlock_t *lock)

Function Documentation

int pthread_spin_lock ( pthread_spinlock_t *  lock)

Definition at line 23 of file pthread_spin_lock.c.

{
  __asm __volatile
    ("1: ldstub [%0], %%g2\n"
     "   orcc   %%g2, 0x0, %%g0\n"
     "   bne,a  2f\n"
     "   ldub   [%0], %%g2\n"
     ".subsection 2\n"
     "2: orcc   %%g2, 0x0, %%g0\n"
     "   bne,a  2b\n"
     "   ldub   [%0], %%g2\n"
     "   b,a    1b\n"
     ".previous"
     : /* no outputs */
     : "r" (lock)
     : "g2", "memory", "cc");
  return 0;
}