Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
February 03, 2018 Thread safe reference counting | ||||
---|---|---|---|---|
| ||||
That RCSharedAllocator PR made me think, so this is my take on how to keep reference counted allocator in shared storage: https://run.dlang.io/is/r1z1dd |
February 06, 2018 Re: Thread safe reference counting | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On Saturday, 3 February 2018 at 14:41:06 UTC, Kagamin wrote: > That RCSharedAllocator PR made me think, so this is my take on how to keep reference counted allocator in shared storage: https://run.dlang.io/is/r1z1dd You might also want to look at Atila Neves's automem package. It uses atomic increment/decrement when the type being reference-counted is `shared`. https://dlang.org/blog/2017/04/28/automem-hands-free-raii-for-d/ |
February 07, 2018 Re: Thread safe reference counting | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nathan S. | On Tuesday, 6 February 2018 at 10:01:28 UTC, Nathan S. wrote:
> You might also want to look at Atila Neves's automem package. It uses atomic increment/decrement when the type being reference-counted is `shared`.
>
> https://dlang.org/blog/2017/04/28/automem-hands-free-raii-for-d/
That RefCounted only counts on stack, it can't be put in shared storage.
|
February 07, 2018 Re: Thread safe reference counting | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On Wednesday, 7 February 2018 at 07:58:42 UTC, Kagamin wrote:
> On Tuesday, 6 February 2018 at 10:01:28 UTC, Nathan S. wrote:
>> You might also want to look at Atila Neves's automem package. It uses atomic increment/decrement when the type being reference-counted is `shared`.
>>
>> https://dlang.org/blog/2017/04/28/automem-hands-free-raii-for-d/
>
> That RefCounted only counts on stack, it can't be put in shared storage.
There are some bugs with shared at the moment in dmd (I introduced a bug fixing a different bug and now I'm trying to figure out what the best way out of this mess is), so what I'm saying might not compile right now but should:
auto ptr = new shared RefCounted!(...);
Atila
|
February 07, 2018 Re: Thread safe reference counting | ||||
---|---|---|---|---|
| ||||
Posted in reply to Atila Neves | On Wednesday, 7 February 2018 at 14:09:51 UTC, Atila Neves wrote:
> auto ptr = new shared RefCounted!(...);
If you rely only on postblit, then you can't concurrently read and write to refcounted shared storage without additional mutex lock, so it should be at least a non-copyable container (similar to what rust does).
|
Copyright © 1999-2021 by the D Language Foundation