-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Add DCAS overload of Interlocked.CompareExchange #31911
Comments
Our |
Unfortunately I don't know that |
We have a similar issue in ConcurrentQueue (whether to clear a dequeued element and allow its slot to be reused), and the extra meaningful overhead there is incurred only as part of the operations doing the iterating, e.g. GetEnumerator and Count, by setting a flag while such an operation is in progress and only performing the problematic operation if one isn't. They should be rare compared to push and pop. A concurrent stack is the poster child for a primitive like this. It'd be a shame if ours couldn't use it. |
Can we overload |
A CAS that operates atomically on two pointers at once is useful for writing lock-free algorithms.
This would be an intrinsic for
CMPXCHG8B
,CMPXCHG16B
,CASPAL
instructionsSomething like:
The text was updated successfully, but these errors were encountered: