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>
diff --git a/include/openssl/err.h b/include/openssl/err.h
index ddb094c..8ebd73f 100644
--- a/include/openssl/err.h
+++ b/include/openssl/err.h
@@ -256,6 +256,10 @@
 /* ERR_clear_error clears the error queue for the current thread. */
 OPENSSL_EXPORT void ERR_clear_error(void);
 
+/* ERR_remove_thread_state deletes the error queue for the given thread. If
+ * |tid| is NULL then the error queue for the current thread is deleted. */
+OPENSSL_EXPORT void ERR_remove_thread_state(const CRYPTO_THREADID *tid);
+
 
 /* Custom errors. */
 
@@ -482,6 +486,11 @@
    * never returns NULL. */
   ERR_STATE *(*get_state)(void);
 
+  /* release_state returns the |ERR_STATE| for the given thread, or NULL if
+   * none exists. It the return value is not NULL, it also returns ownership of
+   * the |ERR_STATE| and deletes it from its data structures. */
+  ERR_STATE *(*release_state)(const CRYPTO_THREADID *tid);
+
   /* get_next_library returns a unique value suitable for passing as the
    * |library| to error calls. It will be distinct from all built-in library
    * values. */