1*e7be843bSPierre Pronchery /* 2*e7be843bSPierre Pronchery * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. 3*e7be843bSPierre Pronchery * 4*e7be843bSPierre Pronchery * Licensed under the Apache License 2.0 (the "License"). You may not use 5*e7be843bSPierre Pronchery * this file except in compliance with the License. You can obtain a copy 6*e7be843bSPierre Pronchery * in the file LICENSE in the source distribution or at 7*e7be843bSPierre Pronchery * https://www.openssl.org/source/license.html 8*e7be843bSPierre Pronchery */ 9*e7be843bSPierre Pronchery 10*e7be843bSPierre Pronchery #ifndef OPENSSL_INTERNAL_THREAD_H 11*e7be843bSPierre Pronchery # define OPENSSL_INTERNAL_THREAD_H 12*e7be843bSPierre Pronchery # include <openssl/configuration.h> 13*e7be843bSPierre Pronchery # include <internal/thread_arch.h> 14*e7be843bSPierre Pronchery # include <openssl/e_os2.h> 15*e7be843bSPierre Pronchery # include <openssl/types.h> 16*e7be843bSPierre Pronchery # include <internal/cryptlib.h> 17*e7be843bSPierre Pronchery # include "crypto/context.h" 18*e7be843bSPierre Pronchery 19*e7be843bSPierre Pronchery void *ossl_crypto_thread_start(OSSL_LIB_CTX *ctx, CRYPTO_THREAD_ROUTINE start, 20*e7be843bSPierre Pronchery void *data); 21*e7be843bSPierre Pronchery int ossl_crypto_thread_join(void *task, CRYPTO_THREAD_RETVAL *retval); 22*e7be843bSPierre Pronchery int ossl_crypto_thread_clean(void *vhandle); 23*e7be843bSPierre Pronchery uint64_t ossl_get_avail_threads(OSSL_LIB_CTX *ctx); 24*e7be843bSPierre Pronchery 25*e7be843bSPierre Pronchery # if defined(OPENSSL_THREADS) 26*e7be843bSPierre Pronchery 27*e7be843bSPierre Pronchery # define OSSL_LIB_CTX_GET_THREADS(CTX) \ 28*e7be843bSPierre Pronchery ossl_lib_ctx_get_data(CTX, OSSL_LIB_CTX_THREAD_INDEX); 29*e7be843bSPierre Pronchery 30*e7be843bSPierre Pronchery typedef struct openssl_threads_st { 31*e7be843bSPierre Pronchery uint64_t max_threads; 32*e7be843bSPierre Pronchery uint64_t active_threads; 33*e7be843bSPierre Pronchery CRYPTO_MUTEX *lock; 34*e7be843bSPierre Pronchery CRYPTO_CONDVAR *cond_finished; 35*e7be843bSPierre Pronchery } OSSL_LIB_CTX_THREADS; 36*e7be843bSPierre Pronchery 37*e7be843bSPierre Pronchery # endif /* defined(OPENSSL_THREADS) */ 38*e7be843bSPierre Pronchery 39*e7be843bSPierre Pronchery #endif /* OPENSSL_INTERNAL_THREAD_H */ 40