summaryrefslogtreecommitdiffstats
path: root/crypto/async/async.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2015-11-19 21:44:13 +0000
committerMatt Caswell <matt@openssl.org>2015-11-20 23:40:23 +0000
commit22a34c2fab39c38cac4a22a0e15ab9a1fd98f57c (patch)
tree5ce684a33431d24bd40a4d2a50b7ca592f08a8e0 /crypto/async/async.c
parent68487a9b0631d27be9a1f4565e7e652ae9cb6aad (diff)
Implement windows async thread local variable support
Implements Thread Local Storage in the windows async port. This also has some knock on effects to the posix and null implementations. Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/async/async.c')
-rw-r--r--crypto/async/async.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/crypto/async/async.c b/crypto/async/async.c
index c18c5c4517..5664d990b6 100644
--- a/crypto/async/async.c
+++ b/crypto/async/async.c
@@ -330,7 +330,7 @@ static void async_empty_pool(async_pool *pool)
int ASYNC_init(int init_thread, size_t max_size, size_t init_size)
{
- if (!async_thread_local_init())
+ if (!async_global_init())
return 0;
if (init_thread)
@@ -349,6 +349,10 @@ int ASYNC_init_thread(size_t max_size, size_t init_size)
return 0;
}
+ if (!async_local_init()) {
+ ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ASYNC_R_INIT_FAILED);
+ return 0;
+ }
pool = OPENSSL_zalloc(sizeof *pool);
if (pool == NULL) {
ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ERR_R_MALLOC_FAILURE);
@@ -383,7 +387,6 @@ int ASYNC_init_thread(size_t max_size, size_t init_size)
}
}
pool->curr_size = curr_size;
-
if (!async_set_pool(pool)) {
ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ASYNC_R_FAILED_TO_SET_POOL);
goto err;
@@ -404,6 +407,7 @@ static void async_free_pool_internal(async_pool *pool)
sk_ASYNC_JOB_free(pool->jobs);
OPENSSL_free(pool);
(void)async_set_pool(NULL);
+ async_local_cleanup();
async_ctx_free();
}