On Oct 7, 2009, at 8:19 AM, Thomas Harning Jr. wrote:
I'm writing a browser and a library that use OpenSSL for cryptography
support.  I want to best be able to fully cleanup state when my
plugin/library is unloaded, however it seems to me that it's not
possible to clear out all thread-associated error state since I'm not
managing the threads accessing my code.

Example:
Thread A - loads plugin
Thread B - access plugin code (note: thread-safe)
     plugin code raises OpenSSL error... cleans out error stack
after reporting
Thread A - unloads plugin, tries to cleanup OpenSSL

Thread B's actual state is not freed since it is unknown to the plugin
code whether a given thread is "done" accessing code.  In thread A
during shutdown, it only knows about thread A and the need to clean
it's state.

I may be completely clueless here, but since no one else has replied: does ERR_remove_thread_state(NULL) (previously ERR_remove_state(0)) do what you need? You'd need to call it in thread B, and as a result you'd end up creating and destroying the thread state each time you get invoked, but...


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [email protected]

Reply via email to