Atomic bit operations
Crayo List
crayolist at gmail.com
Tue Dec 11 02:17:02 UTC 2018
On Tuesday, 11 December 2018 at 01:37:25 UTC, Adam D. Ruppe wrote:
> On Monday, 10 December 2018 at 23:20:22 UTC, Crayo List wrote:
>> Are there atomic equivalents of bt(), btc(), bts(), btr() ...
>> etc from core.bitop?
>
> Those are intrinsics that compile into a single cpu
> instruction, so they are probably already atomic...
Thanks Adam,
They need to be prefixed with 'lock' (on x86) in order to be
atomic.
That's what _interlockedbittestandset() on Windows does.
And what this page says;
https://www.felixcloutier.com/x86/LOCK.html
It may be possible to implement using asm { }, but I was
wondering if there wasn't something out there already doing it.
More information about the Digitalmars-d-learn
mailing list