summaryrefslogtreecommitdiff
path: root/accel-pptpd/triton/spinlock.h
diff options
context:
space:
mode:
Diffstat (limited to 'accel-pptpd/triton/spinlock.h')
-rw-r--r--accel-pptpd/triton/spinlock.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/accel-pptpd/triton/spinlock.h b/accel-pptpd/triton/spinlock.h
index a75e29c..7da93f8 100644
--- a/accel-pptpd/triton/spinlock.h
+++ b/accel-pptpd/triton/spinlock.h
@@ -2,15 +2,17 @@
#define __TRITON_SPINLOCK_H
#ifdef USE_SPINLOCK
-typedef spinlock_t unsigned char;
+typedef unsigned char spinlock_t;
#define spin_lock(l) {while(__sync_lock_test_and_set(l,1);}
#define spin_unlock(l) __sync_lock_release(l)
#define SPINLOCK_INITIALIZER 0
#else
-typedef spinlock_t pthread_mutex_t;
+#include <pthread.h>
+typedef pthread_mutex_t spinlock_t;
#define spin_lock(l) pthread_mutex_lock(l)
#define spin_unlock(l) pthread_mutex_unlock(l)
#define SPINLOCK_INITIALIZER PTHREAD_MUTEX_INITIALIZER
+#define spinlock_init(l) pthread_mutex_init(l,NULL)
#endif
#endif