wininet(3/4): Set callbacks needed by OpenSSL for multithreaded use

Alexandre Julliard julliard at winehq.org
Thu Oct 1 07:06:21 CDT 2009


Juan Lang <juan.lang at gmail.com> writes:

> +static HANDLE *ssl_locks;
> +
> +static unsigned long ssl_thread_id(void)
> +{
> +    return GetThreadId(GetCurrentThread());
> +}

You want GetCurrentThreadId();

> +static void ssl_lock_callback(int mode, int type, const char *file, int line)
> +{
> +    if (mode & CRYPTO_LOCK)
> +        WaitForSingleObject(ssl_locks[type], INFINITE);
> +    else
> +        ReleaseMutex(ssl_locks[type]);
> +}

You should use critical sections instead, it will be faster.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list