]>
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 | 10 | /* This must be the first #include file */ |
27949c35 | 11 | #include "../async_locl.h" |
50108304 MC |
12 | |
13 | #ifdef ASYNC_WIN | |
14 | ||
15 | # include <windows.h> | |
d63de0eb MC |
16 | # include "internal/cryptlib.h" |
17 | ||
667867cc MC |
18 | int ASYNC_is_capable(void) |
19 | { | |
20 | return 1; | |
21 | } | |
22 | ||
22a34c2f MC |
23 | void async_local_cleanup(void) |
24 | { | |
224905f8 | 25 | async_ctx *ctx = async_get_ctx(); |
22a34c2f MC |
26 | if (ctx != NULL) { |
27 | async_fibre *fibre = &ctx->dispatcher; | |
28 | if(fibre != NULL && fibre->fibre != NULL && fibre->converted) { | |
29 | ConvertFiberToThread(); | |
30 | fibre->fibre = NULL; | |
31 | } | |
32 | } | |
33 | } | |
34 | ||
636ca4ff | 35 | int async_fibre_init_dispatcher(async_fibre *fibre) |
50108304 | 36 | { |
7b9f8f7f MC |
37 | fibre->fibre = ConvertThreadToFiber(NULL); |
38 | if (fibre->fibre == NULL) { | |
39 | fibre->converted = 0; | |
40 | fibre->fibre = GetCurrentFiber(); | |
41 | if (fibre->fibre == NULL) | |
22a34c2f | 42 | return 0; |
50108304 | 43 | } else { |
7b9f8f7f | 44 | fibre->converted = 1; |
50108304 | 45 | } |
7b9f8f7f | 46 | |
50108304 MC |
47 | return 1; |
48 | } | |
49 | ||
636ca4ff | 50 | VOID CALLBACK async_start_func_win(PVOID unused) |
50108304 | 51 | { |
636ca4ff | 52 | async_start_func(); |
50108304 MC |
53 | } |
54 | ||
55 | #endif |