Re: Locking data

2018-05-23 Thread Malte via Digitalmars-d-learn
On Wednesday, 23 May 2018 at 13:36:20 UTC, rikki cattermole wrote: On 24/05/2018 1:29 AM, Malte wrote: On Wednesday, 23 May 2018 at 13:24:35 UTC, rikki cattermole wrote: 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 da

Re: Locking data

2018-05-23 Thread rikki cattermole via Digitalmars-d-learn
On 24/05/2018 1:29 AM, Malte wrote: On Wednesday, 23 May 2018 at 13:24:35 UTC, rikki cattermole wrote: 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; } [

Re: Locking data

2018-05-23 Thread Malte via Digitalmars-d-learn
On Wednesday, 23 May 2018 at 13:24:35 UTC, rikki cattermole wrote: 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 looki

Re: Locking data

2018-05-23 Thread Malte via Digitalmars-d-learn
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 XCH

Re: Locking data

2018-05-23 Thread rikki cattermole via Digitalmars-d-learn
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 li

Re: Locking data

2018-05-22 Thread IntegratedDimensions via Digitalmars-d-learn
On Tuesday, 22 May 2018 at 23:09:24 UTC, Sjoerd Nijboer wrote: On Tuesday, 22 May 2018 at 22:17:05 UTC, IntegratedDimensions wrote: On Tuesday, 22 May 2018 at 22:10:52 UTC, Alex wrote: On Tuesday, 22 May 2018 at 21:45:07 UTC, IntegratedDimensions wrote: an idea to lock data by removing the ref

Re: Locking data

2018-05-22 Thread Sjoerd Nijboer via Digitalmars-d-learn
On Tuesday, 22 May 2018 at 22:17:05 UTC, IntegratedDimensions wrote: On Tuesday, 22 May 2018 at 22:10:52 UTC, Alex 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; } The idea is that wh

Re: Locking data

2018-05-22 Thread IntegratedDimensions via Digitalmars-d-learn
On Tuesday, 22 May 2018 at 22:10:52 UTC, Alex 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; } The idea is that when the data is going to be used, the user locks the data. The trick h

Re: Locking data

2018-05-22 Thread Alex via Digitalmars-d-learn
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; } The idea is that when the data is going to be used, the user locks the data. The trick here is that data is a pointer to the data and the poi

Locking data

2018-05-22 Thread IntegratedDimensions via Digitalmars-d-learn
an idea to lock data by removing the reference: class A { Lockable!Data data; } The idea is that when the data is going to be used, the user locks the data. The trick here is that data is a pointer to the data and the pointer is set to null when locked so no other data can use it(they see