2010-11-12 18:26:36 +08:00
|
|
|
#ifndef __PTHREAD_SPIN_H__
|
|
|
|
#define __PTHREAD_SPIN_H__
|
|
|
|
#include <pthread.h>
|
|
|
|
|
2010-11-15 08:25:37 +08:00
|
|
|
/* spinlock implementation, (ADVANCED REALTIME THREADS)*/
|
2010-11-12 18:26:36 +08:00
|
|
|
struct pthread_spinlock
|
|
|
|
{
|
2010-11-15 08:25:37 +08:00
|
|
|
int lock;
|
2010-11-12 18:26:36 +08:00
|
|
|
};
|
|
|
|
typedef struct pthread_spinlock pthread_spinlock_t;
|
|
|
|
|
|
|
|
int pthread_spin_init (pthread_spinlock_t *lock, int pshared);
|
|
|
|
int pthread_spin_destroy (pthread_spinlock_t *lock);
|
|
|
|
|
|
|
|
int pthread_spin_lock (pthread_spinlock_t * lock);
|
|
|
|
int pthread_spin_trylock (pthread_spinlock_t * lock);
|
|
|
|
int pthread_spin_unlock (pthread_spinlock_t * lock);
|
|
|
|
|
|
|
|
#endif
|