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 #ifndef OPENSSL_INTERNAL_THREAD_H
11 # define OPENSSL_INTERNAL_THREAD_H
12 # include <openssl/configuration.h>
13 # include <internal/thread_arch.h>
14 # include <openssl/e_os2.h>
15 # include <openssl/types.h>
16 # include <internal/cryptlib.h>
17 # include "crypto/context.h"
19 void *ossl_crypto_thread_start(OSSL_LIB_CTX *ctx, CRYPTO_THREAD_ROUTINE start,
21 int ossl_crypto_thread_join(void *task, CRYPTO_THREAD_RETVAL *retval);
22 int ossl_crypto_thread_clean(void *vhandle);
23 uint64_t ossl_get_avail_threads(OSSL_LIB_CTX *ctx);
25 # if defined(OPENSSL_THREADS)
27 # define OSSL_LIB_CTX_GET_THREADS(CTX) \
28 ossl_lib_ctx_get_data(CTX, OSSL_LIB_CTX_THREAD_INDEX);
30 typedef struct openssl_threads_st {
32 uint64_t active_threads;
34 CRYPTO_CONDVAR *cond_finished;
35 } OSSL_LIB_CTX_THREADS;
37 # endif /* defined(OPENSSL_THREADS) */
39 #endif /* OPENSSL_INTERNAL_THREAD_H */