socsvn commit: r238804 - in soc2012/gmiller/locking-head: .
lib/libwitness
gmiller at FreeBSD.org
gmiller at FreeBSD.org
Mon Jul 2 13:10:07 UTC 2012
Author: gmiller
Date: Mon Jul 2 13:10:06 2012
New Revision: 238804
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238804
Log:
r238821 at FreeBSD-dev: root | 2012-06-29 15:25:31 -0500
Add wrappers for spinlocks.
Modified:
soc2012/gmiller/locking-head/ (props changed)
soc2012/gmiller/locking-head/lib/libwitness/wrappers.c
Modified: soc2012/gmiller/locking-head/lib/libwitness/wrappers.c
==============================================================================
--- soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Mon Jul 2 13:09:56 2012 (r238803)
+++ soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Mon Jul 2 13:10:06 2012 (r238804)
@@ -32,15 +32,18 @@
int _pthread_mutex_timedlock(pthread_mutex_t *mutex,
const struct timespec *ts);
int _pthread_mutex_unlock(pthread_mutex_t *mutex);
-int _pthread_rwlock_rdlock(pthread_rwlock_t *mutex);
-int _pthread_rwlock_tryrdlock(pthread_rwlock_t *mutex);
-int _pthread_rwlock_timedrdlock(pthread_rwlock_t *mutex,
+int _pthread_rwlock_rdlock(pthread_rwlock_t *rwlock);
+int _pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock);
+int _pthread_rwlock_timedrdlock(pthread_rwlock_t *rwlock,
const struct timespec *ts);
-int _pthread_rwlock_wrlock(pthread_rwlock_t *mutex);
-int _pthread_rwlock_trywrlock(pthread_rwlock_t *mutex);
-int _pthread_rwlock_timedwrlock(pthread_rwlock_t *mutex,
+int _pthread_rwlock_wrlock(pthread_rwlock_t *rwlock);
+int _pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock);
+int _pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock,
const struct timespec *ts);
-int _pthread_rwlock_unlock(pthread_rwlock_t *mutex);
+int _pthread_rwlock_unlock(pthread_rwlock_t *rwlock);
+int _pthread_spin_lock(pthread_spinlock_t *spin);
+int _pthread_spin_trylock(pthread_spinlock_t *spin);
+int _pthread_spin_unlock(pthread_spinlock_t *spin);
pthread_mutex_t witness_mtx = PTHREAD_MUTEX_INITIALIZER;
@@ -186,3 +189,42 @@
return (ret);
}
+
+int
+pthread_spin_lock(pthread_spinlock_t *spin)
+{
+ int ret;
+
+ ret = _pthread_spin_lock(spin);
+ if (ret == 0) {
+ add_lock(spin);
+ }
+
+ return (ret);
+}
+
+int
+pthread_spin_trylock(pthread_spinlock_t *spin)
+{
+ int ret;
+
+ ret = _pthread_spin_lock(spin);
+ if (ret == 0) {
+ add_lock(spin);
+ }
+
+ return (ret);
+}
+
+int
+pthread_spin_unlock(pthread_spinlock_t *spin)
+{
+ int ret;
+
+ ret = _pthread_spin_unlock(spin);
+ if (ret == 0) {
+ remove_lock(spin);
+ }
+
+ return (ret);
+}
More information about the svn-soc-all
mailing list