[PATCH 1/6] vkd3d: Enable MSVC to compile.

Conor McCarthy conor.mccarthy.444 at gmail.com
Mon Sep 30 22:10:48 CDT 2019


On Tue, Oct 1, 2019 at 12:17 AM Hans-Kristian Arntzen <
post at arntzen-software.no> wrote:

> +
> +typedef struct pthread
> +{
> +    HANDLE thread;
> +    DWORD id;
> +} pthread_t;
> +
> +typedef struct pthread_mutex
> +{
> +    CRITICAL_SECTION *lock;
> +} pthread_mutex_t;
> +
> +typedef struct pthread_cond
> +{
> +    CONDITION_VARIABLE *cond;
> +} pthread_cond_t;
> +
> +struct vkd3d_pthread_wrapper_struct
> +{
> +    void * (*routine)(void *);
> +    void *arg;
> +};
> +
> +static DWORD WINAPI win32_thread_wrapper_routine(struct
> vkd3d_pthread_wrapper_struct *wrapper)
> +{
> +    struct vkd3d_pthread_wrapper_struct tmp = *wrapper;
> +    vkd3d_free(wrapper);
> +    tmp.routine(tmp.arg);
> +    return 0;
> +}
>
>
FWIW, ZStandard avoids complications with thread wrapping by declaring the
function pointer and arg within its pthread_t struct:
https://github.com/facebook/zstd/blob/dev/lib/common/threading.h
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20191001/892b6d8a/attachment.htm>


More information about the wine-devel mailing list