lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, May 20, 2020 at 4:49 PM Joseph C. Sible <josephcsible@gmail.com> wrote:
>
> I know relying on "volatile" is technically incorrect according to the
> standard, but I think it's the least bad option here anyway for two
> reasons: First, as you said, Lua already makes the assumption that
> this works, so my new code won't be broken on any platforms where
> regular hooks aren't already broken, and it so happens that on amd64
> at least, it does work correctly. Second, using atomics would require
> C11, which Lua doesn't currently require, and they're not compatible
> between C and C++, so it'd be a horrible #ifdef soup of three
> different versions of all of the code that uses them. Now having said
> that, I think it is a neat idea to try even if it is too messy to
> incorporate, so I think I will write another patch that does that.

As promised: attached here and online at
https://github.com/josephcsible/lua/commit/488fd22ff4ce0b55e0c0fdc482453b038fa2dbd3

Joseph C. Sible

Attachment: 0001-Use-atomics-when-available.patch
Description: Binary data