Provide a thread stop API
Add the OPENSSL_INIT_thread_stop() function. Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
parent
8793f012f1
commit
71567a6f41
@ -234,8 +234,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|||||||
case DLL_THREAD_ATTACH:
|
case DLL_THREAD_ATTACH:
|
||||||
break;
|
break;
|
||||||
case DLL_THREAD_DETACH:
|
case DLL_THREAD_DETACH:
|
||||||
ossl_init_thread_stop(
|
OPENSSL_INIT_thread_stop();
|
||||||
(struct thread_local_inits_st *)ossl_init_get_thread_local(0));
|
|
||||||
break;
|
break;
|
||||||
case DLL_PROCESS_DETACH:
|
case DLL_PROCESS_DETACH:
|
||||||
break;
|
break;
|
||||||
|
@ -65,7 +65,6 @@ struct thread_local_inits_st {
|
|||||||
};
|
};
|
||||||
void *ossl_init_get_thread_local(int alloc);
|
void *ossl_init_get_thread_local(int alloc);
|
||||||
int ossl_init_thread_start(uint64_t opts);
|
int ossl_init_thread_start(uint64_t opts);
|
||||||
void ossl_init_thread_stop(struct thread_local_inits_st *locals);
|
|
||||||
/*
|
/*
|
||||||
* OPENSSL_INIT flags. The primary list of these is in crypto.h. Flags below
|
* OPENSSL_INIT flags. The primary list of these is in crypto.h. Flags below
|
||||||
* are those ommitted from crypto.h because they are "reserverd for internal
|
* are those ommitted from crypto.h because they are "reserverd for internal
|
||||||
|
@ -77,6 +77,8 @@
|
|||||||
#include <internal/err.h>
|
#include <internal/err.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
static void ossl_init_thread_stop(struct thread_local_inits_st *locals);
|
||||||
|
|
||||||
/* Implement "once" functionality */
|
/* Implement "once" functionality */
|
||||||
#if !defined(OPENSSL_THREADS)
|
#if !defined(OPENSSL_THREADS)
|
||||||
typedef int OPENSSL_INIT_ONCE;
|
typedef int OPENSSL_INIT_ONCE;
|
||||||
@ -466,7 +468,7 @@ static void ossl_init_zlib(void)
|
|||||||
zlib_inited = 1;
|
zlib_inited = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ossl_init_thread_stop(struct thread_local_inits_st *locals)
|
static void ossl_init_thread_stop(struct thread_local_inits_st *locals)
|
||||||
{
|
{
|
||||||
/* Can't do much about this */
|
/* Can't do much about this */
|
||||||
if (locals == NULL)
|
if (locals == NULL)
|
||||||
@ -492,6 +494,12 @@ void ossl_init_thread_stop(struct thread_local_inits_st *locals)
|
|||||||
ossl_init_thread_stop_cleanup();
|
ossl_init_thread_stop_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OPENSSL_INIT_thread_stop(void)
|
||||||
|
{
|
||||||
|
ossl_init_thread_stop(
|
||||||
|
(struct thread_local_inits_st *)ossl_init_get_thread_local(0));
|
||||||
|
}
|
||||||
|
|
||||||
int ossl_init_thread_start(uint64_t opts)
|
int ossl_init_thread_start(uint64_t opts)
|
||||||
{
|
{
|
||||||
struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
|
struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
|
||||||
|
@ -601,6 +601,7 @@ void OPENSSL_INIT_library_stop(void);
|
|||||||
void OPENSSL_INIT_crypto_library_start(uint64_t opts,
|
void OPENSSL_INIT_crypto_library_start(uint64_t opts,
|
||||||
const OPENSSL_INIT_SETTINGS *settings);
|
const OPENSSL_INIT_SETTINGS *settings);
|
||||||
int OPENSSL_INIT_register_stop_handler(void (*handler)(void));
|
int OPENSSL_INIT_register_stop_handler(void (*handler)(void));
|
||||||
|
void OPENSSL_INIT_thread_stop(void);
|
||||||
|
|
||||||
/* BEGIN ERROR CODES */
|
/* BEGIN ERROR CODES */
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user