Work around missing PTHREAD_RWLOCK_INITIALIZER in NaCl newlib.

This can be removed once NaCl is fixed and the fix rolls into Chromium. See
https://code.google.com/p/nativeclient/issues/detail?id=4160

See
https://codereview.chromium.org/951583004/diff/60001/src/untrusted/pthread/pthread.h#pair-132
https://codereview.chromium.org/951583004/diff/60001/src/untrusted/pthread/nc_rwlock.c#pair-48

Change-Id: I21e6d97b24c17f21aa97ee0f71d374400455c441
Reviewed-on: https://boringssl-review.googlesource.com/4590
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
David Benjamin 2015-04-29 13:24:56 -04:00 committed by David Benjamin
parent d33908e8d6
commit 68de407b5f

View File

@ -369,7 +369,19 @@ OPENSSL_EXPORT void CRYPTO_once(CRYPTO_once_t *once, void (*init)(void));
struct CRYPTO_STATIC_MUTEX {
pthread_rwlock_t lock;
};
#if !defined(PTHREAD_RWLOCK_INITIALIZER) && defined(__native_client__) && \
defined(_NEWLIB_VERSION)
/* newlib under NaCl is missing PTHREAD_RWLOCK_INITIALIZER. See
* https://code.google.com/p/nativeclient/issues/detail?id=4160. Remove this
* when that bug is fixed. */
#define CRYPTO_STATIC_MUTEX_INIT \
{ { PTHREAD_MUTEX_INITIALIZER, 0, 0, NACL_PTHREAD_ILLEGAL_THREAD_ID, \
PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER } }
#else
#define CRYPTO_STATIC_MUTEX_INIT { PTHREAD_RWLOCK_INITIALIZER }
#endif
#else
struct CRYPTO_STATIC_MUTEX {
CRYPTO_once_t once;