1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #include <errno.h>
- #include "pthreadP.h"
- int
- pthread_spin_trylock (pthread_spinlock_t *lock)
- {
- unsigned int old;
- int err = EBUSY;
- __asm__ ("1: lwarx %0,0,%2\n"
- " cmpwi 0,%0,0\n"
- " bne 2f\n"
- " stwcx. %3,0,%2\n"
- " bne- 1b\n"
- " li %1,0\n"
- " isync\n"
- "2: "
- : "=&r" (old), "=&r" (err)
- : "r" (lock), "r" (1), "1" (err)
- : "cr0", "memory");
- return err;
- }
|