-
Notifications
You must be signed in to change notification settings - Fork 67
Description
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:
Line 197 in 51e276e
| #if (defined(WITH_THREAD) && !defined(_MSC_VER) && \ |
Line 46 in 51e276e
| # 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