Back to index

glibc  2.9
Defines | Typedefs | Functions
machine-lock.h File Reference

Go to the source code of this file.


#define _EXTERN_INLINE   __extern_inline


typedef __volatile long int __spin_lock_t


_EXTERN_INLINE void __spin_unlock (__spin_lock_t *__lock)
_EXTERN_INLINE int __spin_try_lock (register __spin_lock_t *__lock)
_EXTERN_INLINE int __spin_lock_locked (__spin_lock_t *__lock)

Define Documentation


Definition at line 29 of file machine-lock.h.

Definition at line 33 of file machine-lock.h.

Typedef Documentation

Definition at line 25 of file machine-lock.h.

Function Documentation

Definition at line 74 of file machine-lock.h.

  return *__lock != 0;

Definition at line 48 of file machine-lock.h.

  register long int __rtn, __tmp;

      __asm__ __volatile__ ("mb; ldq_l %0,%1" /* Load lock value into TMP.  */
                         : "=r" (__tmp) : "m" (*__lock));
      __rtn = 2;            /* Load locked value into RTN.  */
      if (__tmp)
       /* The lock is already taken.  */
       return 0;

      /* The lock is not taken; try to get it now.  */
      __asm__ __volatile__ ("stq_c %0,%1"
                         : "=r" (__rtn), "=m" (*__lock)
                         : "0" (__rtn), "1" (*__lock));
      /* RTN is clear if stq_c was interrupted; loop to try the lock again.  */
   } while (! __rtn);
  /* RTN is now nonzero; we have the lock.  */
  return __rtn;

Here is the call graph for this function:

Definition at line 39 of file machine-lock.h.

  __asm__ __volatile__ ("mb; stq $31, %0; mb"
                     : "=m" (__lock));

Here is the call graph for this function: