1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- #include <errno.h>
- #include <pthread.h>
- #include "internals.h"
- int
- __pthread_spin_lock (pthread_spinlock_t *lock)
- {
- unsigned int val;
- do
- __asm__ __volatile__ ("ldcw %1,%0"
- : "=r" (val), "=m" (*lock)
- : "m" (*lock));
- while (!val);
- return 0;
- }
- weak_alias (__pthread_spin_lock, pthread_spin_lock)
- int
- __pthread_spin_trylock (pthread_spinlock_t *lock)
- {
- unsigned int val;
- __asm__ __volatile__ ("ldcw %1,%0"
- : "=r" (val), "=m" (*lock)
- : "m" (*lock));
- return val ? 0 : EBUSY;
- }
- weak_alias (__pthread_spin_trylock, pthread_spin_trylock)
- int
- __pthread_spin_unlock (pthread_spinlock_t *lock)
- {
- *lock = 1;
- return 0;
- }
- weak_alias (__pthread_spin_unlock, pthread_spin_unlock)
- int
- __pthread_spin_init (pthread_spinlock_t *lock, int pshared)
- {
-
- *lock = 1;
- return 0;
- }
- weak_alias (__pthread_spin_init, pthread_spin_init)
- int
- __pthread_spin_destroy (pthread_spinlock_t *lock)
- {
-
- return 0;
- }
- weak_alias (__pthread_spin_destroy, pthread_spin_destroy)
|