diff options
author | Matt Caswell <matt@openssl.org> | 2015-09-16 23:43:45 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2015-11-20 23:33:46 +0000 |
commit | d63de0ebff88c4ef1d93065c4e531fdf5ed894fe (patch) | |
tree | 7d4ca66376a9ba38d1a4c279ba2dd45b422bba8d /crypto/async/async.c | |
parent | 5e6f9775a9db38b50c2f5487f126b58f7bfff78e (diff) | |
download | openssl-d63de0ebff88c4ef1d93065c4e531fdf5ed894fe.zip openssl-d63de0ebff88c4ef1d93065c4e531fdf5ed894fe.tar.gz openssl-d63de0ebff88c4ef1d93065c4e531fdf5ed894fe.tar.bz2 |
Implement windows async pool and notify support
Port the async pool and notify code to windows.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/async/async.c')
-rw-r--r-- | crypto/async/async.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/crypto/async/async.c b/crypto/async/async.c index c1f9b22..ed3ed73 100644 --- a/crypto/async/async.c +++ b/crypto/async/async.c @@ -295,6 +295,16 @@ int ASYNC_in_job(void) return 0; } +static void async_empty_pool(STACK_OF(ASYNC_JOB) *pool) +{ + ASYNC_JOB *job; + + do { + job = sk_ASYNC_JOB_pop(pool); + ASYNC_JOB_free(job); + } while (job); +} + int ASYNC_init_pool(size_t max_size, size_t init_size) { STACK_OF(ASYNC_JOB) *pool; @@ -326,23 +336,24 @@ int ASYNC_init_pool(size_t max_size, size_t init_size) } } - async_set_pool(pool, curr_size, max_size); + if (!async_set_pool(pool, curr_size, max_size)) { + async_empty_pool(pool); + sk_ASYNC_JOB_free(pool); + return 0; + } return 1; } void ASYNC_free_pool(void) { - ASYNC_JOB *job; STACK_OF(ASYNC_JOB) *pool; pool = async_get_pool(); if (pool == NULL) return; - do { - job = sk_ASYNC_JOB_pop(pool); - ASYNC_JOB_free(job); - } while (job); + + async_empty_pool(pool); async_release_pool(); } |