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.

{
  unsigned int __tmp;

  asm volatile (
       "1:    lwarx  %0,0,%1\n"
       "      cmpwi  0,%0,0\n"
       "      bne-   2f\n"
       "      stwcx. %2,0,%1\n"
       "      bne-   2f\n"
       "      isync\n"
       "      .subsection 1\n"
       "2:    lwzx   %0,0,%1\n"
       "      cmpwi  0,%0,0\n"
       "      bne    2b\n"
       "      b      1b\n"
       "      .previous"
       : "=&r" (__tmp)
       : "r" (lock), "r" (1)
       : "cr0", "memory");
  return 0;
}