2 * Copyright 2015-2022 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 /* This must be the first #include file */
11 #include "../async_local.h"
16 # include "internal/cryptlib.h"
18 int ASYNC_is_capable(void)
23 int ASYNC_set_mem_functions(ASYNC_stack_alloc_fn alloc_fn,
24 ASYNC_stack_free_fn free_fn)
29 void ASYNC_get_mem_functions(ASYNC_stack_alloc_fn *alloc_fn,
30 ASYNC_stack_free_fn *free_fn)
38 void async_local_cleanup(void)
40 async_ctx *ctx = async_get_ctx();
42 async_fibre *fibre = &ctx->dispatcher;
43 if (fibre != NULL && fibre->fibre != NULL && fibre->converted) {
44 ConvertFiberToThread();
50 int async_fibre_init_dispatcher(async_fibre *fibre)
52 # if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600
53 fibre->fibre = ConvertThreadToFiberEx(NULL, FIBER_FLAG_FLOAT_SWITCH);
55 fibre->fibre = ConvertThreadToFiber(NULL);
57 if (fibre->fibre == NULL) {
59 fibre->fibre = GetCurrentFiber();
60 if (fibre->fibre == NULL)
69 VOID CALLBACK async_start_func_win(PVOID unused)