[PATCH 3/6] winhttp: Use the thread pool for asynchronous hostname resolution.

Jacek Caban jacek at codeweavers.com
Fri Nov 23 07:10:31 CST 2018


Hi Hans,

On 11/23/18 11:35 AM, Hans Leidekker wrote:
> -        DWORD status;
> -        HANDLE thread;
> -        struct resolve_args ra;
> -
> -        ra.hostname = hostname;
> -        ra.port     = port;
> -        ra.sa       = sa;
> -
> -        thread = CreateThread( NULL, 0, resolve_proc, &ra, 0, NULL );
> -        if (!thread) return FALSE;
> +        struct async_resolve async;
>   
> -        status = WaitForSingleObject( thread, timeout );
> -        if (status == WAIT_OBJECT_0) GetExitCodeThread( thread, &ret );
> -        else ret = ERROR_WINHTTP_TIMEOUT;
> -        CloseHandle( thread );
> +        async.hostname = hostname;
> +        async.port     = port;
> +        async.addr     = addr;
> +        if (!(async.done = CreateEventW( NULL, FALSE, FALSE, NULL ))) return FALSE;
> +        if (!TrySubmitThreadpoolCallback( resolve_proc, &async, NULL ))


The patch looks good to me, but note that we could consider just using 
GetAddrInfoEx instead (although it doesn't support timeout yet).


Jacek




More information about the wine-devel mailing list