diff options
author | Adam Langley <agl@chromium.org> | 2014-08-06 03:54:47 +0400 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2014-08-12 03:55:44 +0400 |
commit | 03d31ed3e49a71e9ea09232d817cb1200b7a9149 (patch) | |
tree | f25dfc13da7ebe71cfa84c19f7195472bb87ff8e /crypto/err/err_impl.c | |
parent | ded93581f1674f81faa0dba4b15a842756066ab2 (diff) |
Add ERR_remove_thread_state (for Android).
Change-Id: I908d207ccd3d529ec09c687effc2aeb4631127d9
Reviewed-on: https://boringssl-review.googlesource.com/1470
Reviewed-by: David Benjamin <davidben@chromium.org>
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/err/err_impl.c')
-rw-r--r-- | crypto/err/err_impl.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/crypto/err/err_impl.c b/crypto/err/err_impl.c index 6544c7b5..75547149 100644 --- a/crypto/err/err_impl.c +++ b/crypto/err/err_impl.c @@ -265,6 +265,23 @@ static ERR_STATE *err_get_state(void) { return state; } +static ERR_STATE *err_release_state(const CRYPTO_THREADID *tid) { + ERR_STATE pattern, *state; + + CRYPTO_THREADID_cpy(&pattern.tid, tid); + + CRYPTO_r_lock(CRYPTO_LOCK_ERR); + if (state_hash == NULL) { + CRYPTO_r_unlock(CRYPTO_LOCK_ERR); + return NULL; + } + + state = lh_ERR_STATE_delete(state_hash, &pattern); + CRYPTO_r_unlock(CRYPTO_LOCK_ERR); + + return state; +} + static void err_shutdown(void) { CRYPTO_w_lock(CRYPTO_LOCK_ERR); if (error_hash) { @@ -290,5 +307,6 @@ const struct ERR_FNS_st openssl_err_default_impl = { err_set_item, err_del_item, err_get_state, + err_release_state, err_get_next_library, }; |