Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mingw atomics #1601

Merged
merged 2 commits into from
Jun 20, 2022
Merged

Conversation

L0PiTaL
Copy link
Contributor

@L0PiTaL L0PiTaL commented Jun 18, 2022

There are two issues with Mingw atomics defines which are solved by this PR's commits:

  1. InterlockedDecrementAcquire64 was not defined, so the build failed on Mingw.
  2. InterlockedDecrementRelease64 was incorrect. The docs for this function state that
    "The function returns the resulting decremented value."
    The equivalent function for this in Mingw is __atomic_sub_fetch, and not __atomic_fetch_sub (which returns the value previous to the decrement).

Fixes the build error: "InterlockedDecrementAcquire64 not defined" on Mingw
From Microsoft docs, InterlockedDecrementRelease64 returns the resulting decremented value.
The equivalent function on Mingw is `__atomic_sub_fetch`, not `__atomic_fetch_sub` (which returns the previous value).
@L0PiTaL L0PiTaL changed the title Fix mingw atomics undefined Fix mingw atomics Jun 18, 2022
@gdamore
Copy link
Contributor

gdamore commented Jun 20, 2022

Oops, thanks for fixing this. It's unfortunate that mingw needs these special handling cases.

@gdamore gdamore merged commit 27701c0 into nanomsg:master Jun 20, 2022
@L0PiTaL L0PiTaL deleted the fix-mingw-atomics-undefined branch June 21, 2022 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants