12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- #include <errno.h>
- #include <pthread.h>
- #include "internals.h"
- int
- __pthread_spin_lock (pthread_spinlock_t *lock)
- {
- while (! __compare_and_swap ((long int *)lock, 0, 1))
- ;
- return 0;
- }
- weak_alias (__pthread_spin_lock, pthread_spin_lock)
- int
- __pthread_spin_trylock (pthread_spinlock_t *lock)
- {
- return __compare_and_swap ((long int *)lock, 0, 1) ? 0 : EBUSY;
- }
- weak_alias (__pthread_spin_trylock, pthread_spin_trylock)
- int
- __pthread_spin_unlock (pthread_spinlock_t *lock)
- {
- MEMORY_BARRIER ();
- *lock = 0;
- return 0;
- }
- weak_alias (__pthread_spin_unlock, pthread_spin_unlock)
- int
- __pthread_spin_init (pthread_spinlock_t *lock, int pshared)
- {
-
- *lock = 0;
- 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)
|