summaryrefslogtreecommitdiff
path: root/include/sparse
diff options
context:
space:
mode:
authorEthan Jackson <ethan@nicira.com>2013-07-30 15:31:48 -0700
committerBen Pfaff <blp@nicira.com>2013-07-30 21:30:45 -0700
commit97be153858b4cd175cbe7862b8e1624bf22ab98a (patch)
treeab1e518bef4e8bbc97fe8a069d9b91541bb9c4d4 /include/sparse
parent2b51596fdeba7fbf4caff323dd6af375e7f84596 (diff)
downloadopenvswitch-97be153858b4cd175cbe7862b8e1624bf22ab98a.tar.gz
clang: Add annotations for thread safety check.
This commit adds annotations for thread safety check. And the check can be conducted by using -Wthread-safety flag in clang. Co-authored-by: Alex Wang <alexw@nicira.com> Signed-off-by: Alex Wang <alexw@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'include/sparse')
-rw-r--r--include/sparse/pthread.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/include/sparse/pthread.h b/include/sparse/pthread.h
index 6cdf5c8a7..aa4652efc 100644
--- a/include/sparse/pthread.h
+++ b/include/sparse/pthread.h
@@ -26,12 +26,12 @@
int pthread_mutex_lock(pthread_mutex_t *mutex) OVS_ACQUIRES(mutex);
int pthread_mutex_unlock(pthread_mutex_t *mutex) OVS_RELEASES(mutex);
-int pthread_rwlock_rdlock(pthread_rwlock_t *rwlock) OVS_ACQUIRES(rwlock);
-int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock) OVS_ACQUIRES(rwlock);
+int pthread_rwlock_rdlock(pthread_rwlock_t *rwlock) OVS_ACQ_RDLOCK(rwlock);
+int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock) OVS_ACQ_WRLOCK(rwlock);
int pthread_rwlock_unlock(pthread_rwlock_t *rwlock) OVS_RELEASES(rwlock);
int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *mutex)
- OVS_MUST_HOLD(mutex);
+ OVS_REQUIRES(mutex);
/* Sparse complains about the proper PTHREAD_*_INITIALIZER definitions.
* Luckily, it's not a real compiler so we can overwrite it with something
@@ -52,7 +52,7 @@ int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *mutex)
({ \
int retval = pthread_mutex_trylock(mutex); \
if (!retval) { \
- OVS_ACQUIRE(MUTEX); \
+ OVS_MACRO_LOCK(MUTEX); \
} \
retval; \
})
@@ -61,7 +61,7 @@ int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *mutex)
({ \
int retval = pthread_rwlock_tryrdlock(rwlock); \
if (!retval) { \
- OVS_ACQUIRE(RWLOCK); \
+ OVS_MACRO_LOCK(RWLOCK); \
} \
retval; \
})
@@ -69,7 +69,7 @@ int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *mutex)
({ \
int retval = pthread_rwlock_trywrlock(rwlock); \
if (!retval) { \
- OVS_ACQUIRE(RWLOCK); \
+ OVS_MACRO_LOCK(RWLOCK); \
} \
retval; \
})