2 * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 #include <openssl/configuration.h>
11 #include <openssl/thread.h>
12 #include <internal/thread.h>
14 uint32_t OSSL_get_thread_support_flags(void)
18 #if !defined(OPENSSL_NO_THREAD_POOL)
19 support |= OSSL_THREAD_SUPPORT_FLAG_THREAD_POOL;
21 #if !defined(OPENSSL_NO_DEFAULT_THREAD_POOL)
22 support |= OSSL_THREAD_SUPPORT_FLAG_DEFAULT_SPAWN;
28 #if defined(OPENSSL_NO_THREAD_POOL) || defined(OPENSSL_NO_DEFAULT_THREAD_POOL)
30 int OSSL_set_max_threads(OSSL_LIB_CTX *ctx, uint64_t max_threads)
35 uint64_t OSSL_get_max_threads(OSSL_LIB_CTX *ctx)
42 uint64_t OSSL_get_max_threads(OSSL_LIB_CTX *ctx)
45 OSSL_LIB_CTX_THREADS *tdata = OSSL_LIB_CTX_GET_THREADS(ctx);
50 ossl_crypto_mutex_lock(tdata->lock);
51 ret = tdata->max_threads;
52 ossl_crypto_mutex_unlock(tdata->lock);
58 int OSSL_set_max_threads(OSSL_LIB_CTX *ctx, uint64_t max_threads)
60 OSSL_LIB_CTX_THREADS *tdata;
62 tdata = OSSL_LIB_CTX_GET_THREADS(ctx);
66 ossl_crypto_mutex_lock(tdata->lock);
67 tdata->max_threads = max_threads;
68 ossl_crypto_mutex_unlock(tdata->lock);