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"
     "   brnz,pn %%g2, 2f\n"
     "    membar #StoreLoad | #StoreStore\n"
     ".subsection 2\n"
     "2: ldub    [%0], %%g2\n"
     "   brnz,pt %%g2, 2b\n"
     "    membar #LoadLoad\n"
     "   b,a,pt  %%xcc, 1b\n"
     ".previous"
     : /* no outputs */
     : "r" (lock)
     : "g2", "memory");
  return 0;
}