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 fast lock on windows (reassignment oldval) #956

Merged
merged 1 commit into from
Oct 30, 2023

Conversation

Hamayama
Copy link
Contributor

  • コミット 07ed42b (2023-10-28) で、Windows の fast lock (spin lock) が、
    ScmAtomicVar を使うように変更されましたが、
    このときにロックできなくなっていたため修正しました。

  • 以下の test_0002_write で不具合を確認しました。
    https://gist.github.com/Hamayama/fda48fd11d3583653edbbdd9d7d7e714

  • 原因は、src/gauche/priv/atomicP.h で、
    AO_compare_and_swap_full() が 3 パターン定義されていますが、
    元々の libatomic_ops のもの以外は、
    条件不成立時に oldval を現在の値で置き換えるという仕様があったためです。

  • この仕様のために、スピンの2周目で、条件が逆転していました。

<関連 Issue>

@shirok shirok merged commit c9334bc into shirok:master Oct 30, 2023
5 checks passed
@shirok
Copy link
Owner

shirok commented Oct 30, 2023

Good catch! Mahalo.

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.

None yet

2 participants