Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2016-05-24 18:28:36 +0300
committerAdam Langley <agl@google.com>2016-06-01 00:09:29 +0300
commit29270dea85741f69bd080bea6b28a83476c2bc91 (patch)
treef1281b90a8819c5f7cadce0482b0fbe367f92f02 /crypto/thread_pthread.c
parent053931e74e42bebd129d9b35d9aceb986e873a8f (diff)
Split unlock functions into read/write variants.
Windows SRWLOCK requires you call different functions here. Split them up in preparation for switching Windows from CRITICAL_SECTION. BUG=37 Change-Id: I7b5c6a98eab9ae5bb0734b805cfa1ff334918f35 Reviewed-on: https://boringssl-review.googlesource.com/8080 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/thread_pthread.c')
-rw-r--r--crypto/thread_pthread.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/crypto/thread_pthread.c b/crypto/thread_pthread.c
index 2a1c9f8a..2baa2b4d 100644
--- a/crypto/thread_pthread.c
+++ b/crypto/thread_pthread.c
@@ -45,7 +45,13 @@ void CRYPTO_MUTEX_lock_write(CRYPTO_MUTEX *lock) {
}
}
-void CRYPTO_MUTEX_unlock(CRYPTO_MUTEX *lock) {
+void CRYPTO_MUTEX_unlock_read(CRYPTO_MUTEX *lock) {
+ if (pthread_rwlock_unlock((pthread_rwlock_t *) lock) != 0) {
+ abort();
+ }
+}
+
+void CRYPTO_MUTEX_unlock_write(CRYPTO_MUTEX *lock) {
if (pthread_rwlock_unlock((pthread_rwlock_t *) lock) != 0) {
abort();
}
@@ -67,7 +73,13 @@ void CRYPTO_STATIC_MUTEX_lock_write(struct CRYPTO_STATIC_MUTEX *lock) {
}
}
-void CRYPTO_STATIC_MUTEX_unlock(struct CRYPTO_STATIC_MUTEX *lock) {
+void CRYPTO_STATIC_MUTEX_unlock_read(struct CRYPTO_STATIC_MUTEX *lock) {
+ if (pthread_rwlock_unlock(&lock->lock) != 0) {
+ abort();
+ }
+}
+
+void CRYPTO_STATIC_MUTEX_unlock_write(struct CRYPTO_STATIC_MUTEX *lock) {
if (pthread_rwlock_unlock(&lock->lock) != 0) {
abort();
}