Skip to content

Is it safe to call OPENSSL_thread_stop multiple times? #22831

Answered by mattcaswell
jay asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, I believe this should be fine.

OPENSSL_thread_stop calls init_get_thread_local to obtain the THREAD_EVENT_HANDLER list. On a second call of OPENSSL_thread_stop this return value should be NULL.

It then calls init_thread_stop with that value - which just immediately returns if the handler list is NULL, and init_thread_remove_handlers which is a no-op if the handler list is NULL.

Finally it calls OPENSSL_free with the NULL pointer - which is also fine and a no-op.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jay
Comment options

Answer selected by jay
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants