Locking data
rikki cattermole
rikki at cattermole.co.nz
Wed May 23 13:24:35 UTC 2018
On 24/05/2018 1:20 AM, Malte wrote:
> On Tuesday, 22 May 2018 at 21:45:07 UTC, IntegratedDimensions wrote:
>> an idea to lock data by removing the reference:
>>
>> class A
>> {
>> Lockable!Data data;
>> }
>>
>> [...]
>
> This sounds like you are looking for is an atomic swap. Afaik it doesn't
> exist in the standard library. You could use asm for the XCHG, but that
> would make your code x86 dependent.
> I think the easiest way would be to just use a mutex and tryLock.
What are you talking about? :p
http://dpldocs.info/experimental-docs/core.atomic.cas.1.html
More information about the Digitalmars-d-learn
mailing list