Skip to content

Windows on ARM probably misses synchronization for multi-thread initialization in embedded mode #201

@arigo

Description

@arigo

Nowadays, Windows exists for ARM and _MSC_VER is defined there too. This is a problem because these two pieces of code assumes that the presence of _MSC_VER means the architecture is x86/x86-64/amd64, where no read barrier is needed:

#if (defined(WITH_THREAD) && !defined(_MSC_VER) && \

# define cffi_read_barrier() __sync_synchronize()

Also, I'm not sure I remember why the two pieces of code are different. They should be unified, probably. But then, maybe from both a mess-with-too-many-options and a performance perspective, it would be better to use something from pthread: I have not measured but I would guess that calling pthread_once() carefully would work on all platforms(*) and be actually faster than calling low-level read and write barriers. And that's what we use read barriers for in cffi: making sure things are properly initialized.

(*) except Windows, again, which means we still need something else for Windows on ARM

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions