]>
Commit | Line | Data |
---|---|---|
50108304 | 1 | /* |
62867571 | 2 | * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. |
50108304 | 3 | * |
62867571 RS |
4 | * Licensed under the OpenSSL license (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 | |
50108304 MC |
8 | */ |
9 | ||
6e8ac508 VD |
10 | /* |
11 | * Must do this before including any header files, because on MacOS/X <stlib.h> | |
12 | * includes <signal.h> which includes <ucontext.h> | |
13 | */ | |
14 | #if defined(__APPLE__) && defined(__MACH__) && !defined(_XOPEN_SOURCE) | |
15 | # define _XOPEN_SOURCE /* Otherwise incomplete ucontext_t structure */ | |
16 | # pragma GCC diagnostic ignored "-Wdeprecated-declarations" | |
17 | #endif | |
18 | ||
f1f5ee17 AP |
19 | #if defined(_WIN32) |
20 | # include <windows.h> | |
21 | #endif | |
22 | ||
176db6dc | 23 | #include "internal/async.h" |
0ff2b9ac | 24 | #include <openssl/crypto.h> |
50108304 | 25 | |
636ca4ff | 26 | typedef struct async_ctx_st async_ctx; |
27949c35 | 27 | typedef struct async_pool_st async_pool; |
50108304 MC |
28 | |
29 | #include "arch/async_win.h" | |
30 | #include "arch/async_posix.h" | |
9ec1e031 | 31 | #include "arch/async_null.h" |
50108304 MC |
32 | |
33 | struct async_ctx_st { | |
636ca4ff | 34 | async_fibre dispatcher; |
50108304 | 35 | ASYNC_JOB *currjob; |
e8dfb5bf | 36 | unsigned int blocked; |
50108304 MC |
37 | }; |
38 | ||
39 | struct async_job_st { | |
636ca4ff | 40 | async_fibre fibrectx; |
50108304 MC |
41 | int (*func) (void *); |
42 | void *funcargs; | |
43 | int ret; | |
44 | int status; | |
ff75a257 MC |
45 | ASYNC_WAIT_CTX *waitctx; |
46 | }; | |
47 | ||
48 | struct fd_lookup_st { | |
49 | const void *key; | |
50 | OSSL_ASYNC_FD fd; | |
51 | void *custom_data; | |
52 | void (*cleanup)(ASYNC_WAIT_CTX *, const void *, OSSL_ASYNC_FD, void *); | |
53 | int add; | |
54 | int del; | |
55 | struct fd_lookup_st *next; | |
56 | }; | |
57 | ||
58 | struct async_wait_ctx_st { | |
59 | struct fd_lookup_st *fds; | |
60 | size_t numadd; | |
61 | size_t numdel; | |
50108304 MC |
62 | }; |
63 | ||
85885715 | 64 | DEFINE_STACK_OF(ASYNC_JOB) |
0ff2b9ac | 65 | |
27949c35 MC |
66 | struct async_pool_st { |
67 | STACK_OF(ASYNC_JOB) *jobs; | |
68 | size_t curr_size; | |
69 | size_t max_size; | |
70 | }; | |
71 | ||
22a34c2f | 72 | void async_local_cleanup(void); |
636ca4ff | 73 | void async_start_func(void); |
224905f8 | 74 | async_ctx *async_get_ctx(void); |
ff75a257 MC |
75 | |
76 | void async_wait_ctx_reset_counts(ASYNC_WAIT_CTX *ctx); | |
77 |