Skip to content

Add zend_atomic_int #14242

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

Merged
merged 1 commit into from
May 30, 2024
Merged

Add zend_atomic_int #14242

merged 1 commit into from
May 30, 2024

Conversation

arnaud-lb
Copy link
Member

@arnaud-lb arnaud-lb commented May 15, 2024

This extends the zend_atomic_bool API for ints. This also adds zend_atomic_*_compare_exchange and ZEND_ATOMIC_*_INITIALIZER.

This is a dependency of #14054.

Comment on lines +107 to +113
bool prev = (bool) InterlockedCompareExchange8(&obj->value, *expected, desired);
if (prev == *expected) {
return true;
} else {
*expected = prev;
return false;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__c11_atomic_compare_exchange behavior

Copy link
Contributor

@morrisonlevi morrisonlevi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving, but honestly I don't know about the Windows stuff. It looks good to me, but I am no expert there.

@arnaud-lb arnaud-lb merged commit 1ab4520 into php:master May 30, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants